Search code examples
intellij-ideasasscompilationfile-watcher

Intellij: Sass to CSS: file watcher output folder


I have IntelliJ Ultimate Edition and I'm compiling .scss files to .css. The problem is that every .scss file is compiled to .css in the same folder. I don't want that.

My folder structure is like so:

assets -- css ---- main.css -- scss ---- folder -------icons.scss -------elements.scss ---- folder -------navigation.scss ---- main.scss

The main.scss contains all the necessary files to compile to .css. But I ONLY want to compile main.scss to ../css/main.css when I make changes in one of these files/folders in this structure. How can I do that? Thanks so much.


Current settings in the Edit Watcher window in IntelliJ:

Program: D:\Program Files (x86)\Ruby22\bin\scss.bat

Arguments: --no-cache --update $FileName$:$FileNameWithoutExtension$.css

Output paths to refresh: $FileNameWithoutExtension$.css:$FileNameWithoutExtension$.css.map

Working directory: C:\localhost\www\website\assets\sass


Solution

  • Try changing your watcher as follows:

    Arguments: --no-cache --update $FileName$:$ProjectFileDir$/assets/css/$FileNameWithoutExtension$.css
    Output paths to refresh: $ProjectFileDir$/assets/css/$FileNameWithoutExtension$.css:$ProjectFileDir$/assets/css/$FileNameWithoutExtension$.css.map
    

    If your main.scss imports all your partial .scss files, and Track only root files is enabled in file watcher settings, the ../css/main.css will be created/updated when you make changes in any of these files