Sass import of rail engine not working

I created the Rails Engine for assets. I do not use asterisks for css. Instead, I rely on sass @import. This works fine in a test / dummy application, but in a Rails application that requires an engine, it keeps throwing

Sass::SyntaxError: File to import not found or unreadable: gumby. 

I was on this for a while, and initially the path was not in the download path for sass. But then I added

 config.sass.load_paths << "#{Gem.loaded_specs['gumby_on_rails'].full_gem_path}/app/assets/stylesheets" 

for my config/application.rb , and now it definitely shows the correct path to the file I'm trying to import. This is the second path to the last path specified in the following route:

 Sass::SyntaxError: File to import not found or unreadable: gumby. Load paths: CompassRails::SpriteImporter CompassRails::SpriteImporter CompassRails::SpriteImporter CompassRails::SpriteImporter CompassRails::SpriteImporter CompassRails::SpriteImporter CompassRails::SpriteImporter CompassRails::SpriteImporter CompassRails::SpriteImporter /Users/brandon/code/personal/blog_update/app/assets/images /Users/brandon/code/personal/blog_update/app/assets/javascripts /Users/brandon/code/personal/blog_update/app/assets/stylesheets /Users/brandon/code/personal/blog_update/vendor/assets/javascripts /Users/brandon/code/personal/blog_update/vendor/assets/stylesheets /Users/brandon/.rvm/gems/ jruby-1.7.11@blog /gems/angularjs-rails-1.0.7/vendor/assets/javascripts /Users/brandon/.rvm/gems/ jruby-1.7.11@blog /gems/turbolinks-2.2.2/lib/assets/javascripts /Users/brandon/.rvm/gems/ jruby-1.7.11@blog /gems/jquery-rails-3.1.0/vendor/assets/javascripts /Users/brandon/.rvm/gems/ jruby-1.7.11@blog /gems/coffee-rails-4.0.1/lib/assets/javascripts /Users/brandon/code/personal/gumby/app/assets/stylesheets /Users/brandon/code/personal/blog_update/app/assets/stylesheets 

The tree of the rails tree is as follows

 app/ assets/ stylesheets/ gumby/ ... gumby.css.scss 

(I know that technically you should use all your assets in the engine, but I didn’t want to have gumby / gumby, and I feel that the probability of a name clash is slim.)

So, in the test / dummy application, I can import this file via @import 'gumby'; but this fails in the Rails application. With the above exception. How to do it?

And by the way, this is a Rails 4.1 application, and the answers to several other "similar" questions are related to using groups in the Gemfile. Rails 4 got rid of groups, so this is not a problem / solution.

+6
source share
2 answers

So the solution for me was to suck it and skip it gumby/gumby . Then I also had to change config/application.rb to:

 config.assets.paths << "#{Gem.loaded_specs['gumby_on_rails'].full_gem_path}/app/assets/stylesheets" 

And for some reason, modular-scale not required properly, even if the engine has already requested it. So I had to change application.css.scss to application.css.scss.erb and put <% require 'modular-scale' %> at the top.

+2
source

then you should write it like this:

 config.sass.load_paths << "#{Gem.loaded_specs['gumby_on_rails'].full_gem_path}/app/assets/stylesheets/gumby" 

or try this one (untested)

 @import_tree 'gumby'; 
+2
source

All Articles