开发者

Autocompile SASS stylesheet when a partial stylesheet is changed

I've just started working on a project using SASS on a windows machine. The main stylesheet (styles.scss) inports several partials (_typography.scss etc), and styles.scss i开发者_如何转开发s watched by sass and gets automatically compiled to styles.css.

On a mac, any changes to the partials results in styles.scss getting recompiled, but on a pc I have to save styles.scss itself in order to get SASS to compile it. Is there a way I can get a pc to behave the same as a mac?


I was having a similar problem.

My file structure looked like this:

website-root
    _dev
        _some-partial.scss
        _stuff.scss
        main.scss
    css
        main.css
    js
        ...
    watchSass.bat
    ...

I keep my .scss files inside _dev, and compile them out into the css folder.

My previous batch file looked like this:

sass --watch "_dev\main.scss":"css\main.css"

I simply changed it to watch the entire folder, not the specific file, like this:

sass --watch "_dev":"css"

Now changing any .scss file causes the non-partials to be recompiled (in turn recompiling the partials they include).

Thanks to user hlb on freenode #sass for helping me sort that out!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜