Sass filewatcher for webstorm

前端 未结 10 1029
挽巷
挽巷 2020-12-30 12:30

I am trying to use sass in a NodeJS project and this is the library I installed with nodejs

https://www.npmjs.org/package/node-sass

I am using webstorm for t

10条回答
  •  盖世英雄少女心
    2020-12-30 13:17

    1. You need to specify a full path to node-sass.cmd in a Program field (as @LazyOne mentioned)
    2. Specified arguments won't work with node-sass - they are only suitable for standard SASS compiler. Here is a list of node-sass options:
    Usage: node C:\Users\USER\AppData\Roaming\npm\node_modules\node-sass\bin\node-sass
    

    [options] []

    Options:
      --output-style     CSS output style (nested|expanded|compact|compressed)  [default: "nested"]
      --source-comments  Include debug info in output (none|normal|map)         [default: "none"]
      --include-path     Path to look for @import-ed files                      [default: "C:\\Users\\USER\\AppData\\Roaming\\npm"]
      --watch, -w        Watch a directory or file
      --output, -o       Output css file
      --stdout           Print the resulting CSS to stdout
      --help, --help     Print usage info
    

    the simplest setup looks as follows:

    Program: C:\Users\USER\AppData\Roaming\npm\node-sass.cmd
    Arguments: $FileName$ $FileNameWithoutExtension$.css
    Working directory: $FileDir$
    Output paths to refresh: $FileNameWithoutExtension$.css
    
    'Create output from stdout' should be off
    

    With such settings the generated .css file will be placed near the original .scss. If you like to put resultant files into a different folder, try playing with -o option. Like:

    Arguments: $FileName$ -o $ProjectFileDir$/css/$FileNameWithoutExtension$.css
    Output paths to refresh: $ProjectFileDir$/css/$FileNameWithoutExtension$.css
    

提交回复
热议问题