While I was creating a simple engine to wrap a jQuery plugin I realized a
strange behavior.
basically, in gemspec there is "s.add_dependency
''jquery-rails''" and vendor
is set as:
- vendor
- assets
- javascripts
- jquery
- some-plugin.js
- jquery-some-plugin.js
jquery-some-plugin.js
// =require jquery
// =require ./jquery/some-plugin
Then, if you have some application.js like this (included in your layout):
// =require jquery
// ...
And some specific script like this to the HTML header:
// =require jquery-some-plugin
jQuery will be included twice. One for application.js bundle and another
for the other bundle.
This means that any registered jQuery plugins will be removed the next time
jQuery is included.
It would be great if we could specify that another-bundle.js is included
after (ie. depends on) application.js.
That way, by knowing that there will always be an applications.js included
before another-bundle.js the assets pipeline would be able to strip from
another-bundle.js all dependecies already included in application.js.
Would that be feasible/wanted?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-core/-/yWr2l5o0trEJ.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.