Unexpected behaviour when engine has same require as main app in asset pipeline manifest #10171

Closed
alininja opened this Issue Apr 11, 2013 · 3 comments

Comments

Projects
None yet
3 participants

Hi,

I apologize in advance as I'm not sure if this is an issue regarding rails (asset pipeline), jquery-ui-rails, sprocket, or the custom engine.

I have an engine that uses 'jquery-ui-rails' and the main app also uses 'jquery-ui-rails'. If I require "jquery.ui.datepicker" in the engine's manifest, running "rake assets:precompile" will not pull in jquery.ui.datepicker styles into the main app's application.css (even though 'jquery.ui.datepicker' is in the main app's manifest); instead the styles will only be in custom_engine.css.

In the engine:
in "custom_engine/app/assets/stylesheets/custom_engine.css.scss":

/*
 *= require jquery.ui.datepicker
 *= require_self
 *= require_tree ./custom_engine
 */

in "custom_engine/custom_engine.gemspec":

Gem::Specification.new do |s|
  s.add_dependency "jquery-ui-rails"
end

in "custom_engine/lib/custom_engine.rb":

require 'jquery-ui-rails'
module CustomEngine
end

in "custom_engine/lib/custom_engine/engine.rb":

module CustomEngine
  class Engine < :: Rails::Engine
    initializer :assets do |config|
      Rails.application.config.assets.precompile += %w( custom_engine.css custom_engine.js )
    end
  end
end

in the main app:
in "app/assets/stylesheets/application.css":

/*
 *= require jquery.ui.datepicker
 *= require custom_engine
 *= require_directory .
*/

I'd be happy to provide more information, but this is all that I can think of that's relevant.

The workaround right now is to just not require "jquery.ui.datepicker" in the engine's manifest.

Thank you for your time!

Sorry...forgot to mention the versions:
rails 3.2.11 (working on upgrading to 3.2.13)
jquery-ui-rails 2.0.2
sprockets 2.2.2

Thanks again!

Contributor

laurocaetano commented Nov 3, 2013

@alininja could you check if this issue still present on rails 4.0.1? Thanks!

Member

robin850 commented Nov 10, 2013

Actually I think we can close this:

rails 3.2.11 (working on upgrading to 3.2.13)

Please upgrade your application @alininja. Let me know if I misread this ; I will reopen.

@robin850 robin850 closed this Nov 10, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment