Sass-Autocompile


#1

Hello guys

Im using sass, and i divided my css into many _partial files. I have one main style.sass where i imported all sass files and im compiling all into one css when i save my main style.sass. It is kinda annoying because all the time i made change i need to save _partial sass file and then compile main style.sass files too and then i can see change in browser. There must be something for this problem, i mean, i can use gulp/grunt or something like that ? Can you suggest something please ?

Thanks


#2

Have you taken a look at the Atom packages repository? There’s even a package that sounds like it will fit your needs called sass-autocompile.


#3

yea that’s what im talking about. Im using it.


#4

Then I’m not sure what question you’re asking?


#5

Let me explain better. I have file _nav.sass, and style.sass, in style.sass I imported _nav.sass. Now i want to change background color. So i go to _nav.sass and set backgroud-color:red, and save the file. Then i need to go to style.sass and compile on save and then i can see the change on web browser. I need faster solution. I can compile every partial file into css but it is very dirty solution and in the end i will end up with 20 css files and mess in my head. Hope you understand.


#6

I think I understand what you’re saying. Have you tried making a feature request to the sass-autocompile package?


#7

Actually, no I don’t…


#8

I have the same problem. Saving a _partial does not auto compile the main.scss which it should. In order to see any change, one must save the _partial.scss AND the main.scss. In effect this adds an extra action to the process which doesn’t make sense considering Sass is supposed to save us time.

Looking for a solution.


#9

Have you talked to the package maintainers about this?


#10

This problem isn’t a problem at all. Just a misunderstanding.

The answer is in the git repository documentation, and here:

In all of your _partials, paste the comment " // main: main.scss " on the first line and it will save whichever filename comes after main.

In my case, all of my _partials have // main: …/css/main.scss on the first line. My main file name is called main.scss which is in the css folder and the two periods tell Atom to exit the current folder for the partials. Change the file path and name to fit your situation and just make sure it follows "// main: "


#11

Good to know.


#12

can u change it to a settings option ?
i don’t wanna to put in every file this comment … :confused: .
so is this a nice easy plugin !


#13

I have not seen an option for this in the settings. I searched for a long time. But just like you put an underscore before your _partial files you’ll get used to including the short comment at the top of the file. At least I did.


#14

ah sorry i though u were the plugin creator…