Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I import a .scss.erb file in middleman4?

How do I import a .scss.erb file in Middleman 4?

I just upgraded from Middleman 3 to 4. I think this is my last issue...

I have an all.css.scss file that looks like this:

@charset "utf-8";

@import "settings";
@import "imports";
@import "base";
@import "signature_pad"

All the files import except for imports.

The difference with settings is that it is _imports.scss.erb

Then when I try and load all.css I get this:

Error: File to import not found or unreadable: imports.
       Load paths:
         /Users/myMyserId/apps/projectName/source/assets/css
         /Users/myUserId/.rvm/gems/ruby-2.0.0-p451/gems/compass-core-1.0.3/stylesheets
         Compass::SpriteImporter
         /Users/myUserId/apps/projectName/source/assets/css
         /Users/myUserId/.rvm/gems/ruby-2.0.0-p451/gems/compass-core-1.0.3/stylesheets
         Compass::SpriteImporter
         /Users/myUserId/apps/projectName/source/assets/css
         /Users/myUserId/.rvm/gems/ruby-2.0.0-p451/gems/compass-core-1.0.3/stylesheets
         Compass::SpriteImporter
        on line 4 of /Users/myUserId/apps/projectName/source/assets/css/all.css.scss

I think the issue is that the erb is not processing the file before making it a .scss.

like image 355
David Silva Smith Avatar asked Mar 20 '16 13:03

David Silva Smith


People also ask

How do I add a SCSS file to rails?

Start adding @import directives to application. scss . If you are using twitters bootstrap and a few css sheets of your own, you have to import bootstrap first, because it has a sheet to reset styles. So you add @import "bootstrap/bootstrap.

Can I import SCSS in CSS?

scss file. You can also import CSS files. The @import directive imports the file and any variables or mixins defined in the imported file can then be used in the main file.

Can you import sass in SCSS?

The Sass @import directive extends the CSS @import rule so that it works with . scss and . sass files. It imports the file referenced and any variables or mixins that are defined in the imported file so they can be used in the main file.


1 Answers

The difference with settings is that it is _imports.scss.erb

This is your issue. Middleman itself doesn't touch anything with a leading underscore. The .scss files are processed because that's SASS doing the work.

The solution I'm using (until I find another) is to build the second css file and just include it in my layout.

In your case you might try removing the underscore; without the .css suffix it shouldn't be included in the output.

like image 146
balthisar Avatar answered Sep 22 '22 11:09

balthisar