Sass filewatcher for webstorm

前端 未结 10 816
挽巷
挽巷 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:20

    I know this question has been answered, this is for future visitor,

    Phpstorm file watcher does not work very well with node-sass (tested in Phpstorm 8.0.1 windows)

    Instead install node-sass-cli and use following setting

    enter image description here

    0 讨论(0)
  • 2020-12-30 13:22

    I have the same issue. The default configuration by IntelliJ doesn't work.

    This one is worked. You can see the different configuration that is marked in yellow.

    0 讨论(0)
  • 2020-12-30 13:26

    First you need install nodejs and then use npm install -g node-sass. After that set following things to webstorm scss filewatcher:

    • Program: node-sass.cmd
    • Arguments: $FileName$ $FileNameWithoutExtension$.css
    • Working directory: $FileDir$
    • Output paths for refs: $FileNameWithoutExtension$.css
    0 讨论(0)
  • 2020-12-30 13:27

    node-sass requires nothing more than $FileName$ $FileNameWithoutExtension$.css Tested and works in WebStorm 11

    The program parameter needs the full path to the bin/exe though, even when it's globally available. In my case /usr/local/bin/node-sass, in your case it will be the path to the node-sass.cmd.

    node sass cli usage

    node-sass [options] <input> [output] cat <input> | node-sass > output
    

    node sass cli parameters

    -w, --watch                Watch a directory or file
    -r, --recursive            Recursively watch directories or files
    -o, --output               Output directory
    -x, --omit-source-map-url  Omit source map URL comment from output
    -i, --indented-syntax      Treat data from stdin as sass code (versus scss)
    -q, --quiet                Suppress log output except on error
    -v, --version              Prints version info
    --output-style             CSS output style (nested | expanded | compact | compressed)
    --indent-type              Indent type for output CSS (space | tab)
    --indent-width             Indent width; number of spaces or tabs (maximum value: 10)
    --linefeed                 Linefeed style (cr | crlf | lf | lfcr)
    --source-comments          Include debug info in output
    --source-map               Emit source map
    --source-map-contents      Embed include contents in map
    --source-map-embed         Embed sourceMappingUrl as data URI
    --source-map-root          Base path, will be emitted in source-map as is
    --include-path             Path to look for imported files
    --follow                   Follow symlinked directories
    --precision                The amount of precision allowed in decimal numbers
    --importer                 Path to .js file containing custom importer
    --functions                Path to .js file containing custom functions
    --help                     Print usage info
    
    0 讨论(0)
提交回复
热议问题