Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
alininja opened this Issue · 3 comments

3 participants

alininja Lauro Caetano Robin Dupret
alininja

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!

alininja

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!

Lauro Caetano
Collaborator

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

Robin Dupret
Collaborator

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.

Robin Dupret robin850 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.