Don P
Don P

Reputation: 63748

Watch a folder, use a specific entry point, then output a single css file

I have a folder of SCSS files. The main SCSS file is /css/app.scss. It imports all the other SCSS files, like /css/variables.scss and /css/component_a.scss.

How can I have sass watch my /css/ folder for any changes, then recompile starting from /css/app.scss?

Right now it errors since /css/component_a.scss uses variables defined in a different file. But in app.scss they are imported in the correct order.

Upvotes: 1

Views: 242

Answers (1)

shaune
shaune

Reputation: 1030

My answer may be limited because I don't have all the information about how you are compiling sass and what settings you are using.

However I can see that your file names aren't prefixed with an underscore, basically sass will compile every file individually that doesn't have the '_' prefix.

Basically what you want to do is set up your task manager (grunt, gulp, etc) to watch all files ending with '.scss' then tell it to run the sass compile task and have this pointed at your app.scss file.

With the limited information I have from your question I hope that my answer points you in the right direction to solve your problem.

Upvotes: 1

Related Questions