Petran
Petran

Reputation: 8047

Rails sass import css file is not working on staging

I have a .css file in

vendor/assets/stylesheets/myfile.min.css

I am trying to refer to that file from my main.css.scss file

@import 'myfile.min.css';

This works on localhost but not on staging. On my application.rb I have

config.sass.load_paths << Rails.root.join("vendor","assets","stylesheets");

But the file is not been found on staging.

Upvotes: 0

Views: 704

Answers (1)

deefour
deefour

Reputation: 35360

As far as I'm aware, you can't import regular CSS files with Ruby's SASS implementation. I follow Node's SASS implementation more closely, and they just recently tried to disable this functionality stating it doesn't align with the SASS spec.

You should look into Rails' asset pipeline. You would add something like this to the top of your main.css.scss

//= require myfile.min

This puts the import burden on Sprockets, leaving SASS to do it's own thing afterward.

Upvotes: 1

Related Questions