Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I correctly setup the scss file watcher in PhpStorm?

Tags:

sass

phpstorm

I have it working, but with these settings it takes quite a while until the change comes through in PhpStorm. If I get rid of the ../css/ part of the argument string then it creates/updates the css file in the same directory as the scss file is in, but does it immediately. What am I doing wrong?

I'm using PhpStorm 6.0.1 on OS X 10.8.3

My current settings

like image 986
bernk Avatar asked May 09 '13 15:05

bernk


People also ask

How do I set up file watcher?

Creating a File WatcherIn the Settings/Preferences dialog ( Ctrl+Alt+S ), click File Watchers under Tools. The File Watchers page opens showing a list of File Watchers that are already configured in this project and in the IDE. and choose the predefined template from which you want to create a File Watcher.

How can I use SCSS?

To start, create a folder with two folders inside, CSS and images. Then inside the CSS folder create a file with the Sass extension – in my case it's style. scss. Then open it and the file will be detected right away.


3 Answers

as it's mentioned in the previous answer, you have to set up the Output paths option accordingly. Like:

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

Working directory: $FileDir$

Output Paths: $FileParentDir$/css/$FileNameWithoutExtension$.css

Now output paths matches the scss output directory, so that the IDE knows where to look for output and what it looks like

like image 199
lena Avatar answered Oct 13 '22 20:10

lena


I recommend using node-sass it's 10+ times faster

 npm install -g node-sass

Program :

/usr/local/bin/node-sass

Arguments :

$FileName$ $FileNameWithoutExtension$.css

Output Paths :

$FileNameWithoutExtension$.css:$FileNameWithoutExtension$.css.map

enter image description here

Edit :

If you want the css file compressed, use that for the Arguments :

--output-style compressed $FileName$ $FileNameWithoutExtension$.css  
like image 38
dam1 Avatar answered Oct 13 '22 20:10

dam1


For anyone uses node-sass in Windows Env, here you go,

Program:

Windows

C:\Users\%username%\AppData\Roaming\npm\node-sass.cmd

Linux

/usr/local/bin/node-sass

Arguments (Windows):

$FileName$ $ProjectFileDir$\dist\$FileNameWithoutExtension$.css

Output paths for refresh(windows):

$ProjectFileDir$\dist\$FileNameWithoutExtension$.css
like image 15
KuN Avatar answered Oct 13 '22 20:10

KuN