Answer the question
In order to leave comments, you need to log in
How to properly import scss files into a Rails project?
Good afternoon. Small question.
I'm doing a project on RoR. Question about sass.
The structure of the project assets is divided into folders. Scss are imported into main.
//application.scss
@import "variables"
@import "mixins"
@import "pages/home"
Answer the question
In order to leave comments, you need to log in
The problem arises because Rails precompiles each file separately. In config application.rb, you need to change assets.precompile, remove *.css from there
If variables/mixins are declared in other files besides variables & mixins, then in order to be used in other files, you need to import the file with mixins/variables before the file where they are declared.
It's better not to declare global variables in other files.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question