Search code examples
ruby-on-rails-4sassasset-pipelineproduction-environment

Rails 4 .scss in Production not importing .css from vendor/stylesheets


Currently we are not using require tree in our app so as to only load js via their individual controllers, we found that require tree was loading all kinds of crazy nonsense. All help is appreciated. Vendor JS seems to be loading...

No idea how to fix this and I've also tried the following.

ASSETS.RB

Rails.application.config.assets.paths += Dir["#{Rails.root}/vendor/assets/*"].sort_by { |dir| -dir.size }

APPLICATION.RB

config.sass.load_paths << File.expand_path('../../vendor/assets/stylesheets/')

Solution

  • Turns out it's not an error with the rails pipeline, it's an error with sass and loading css. All you need to do is change your .css files to .scss and they all start loading properly.

    On the sass github it does state that it is something they are looking at bringing into their 4.0 release but as of this date it does not work.

    It turned out there were a few more errors but those were fixed by changing a false to true in environments/production.rb for the following line.

      config.assets.compile = true
    
    • Leaving assets as compile true will effect load times.