Node-sass doesn't pipe in npm scripts

324 views Asked by At

I'm using node-sass to compile my scss files to css and then pipe the result to autoprefixer. However, I've eventually found out that node-sass is streaming nothing to stdout when I try to pipe its output, but if and only if I do it via npm scripts.

Here some examples:

  • Pipe with npm

    Npm script: "build:css": "node-sass src/style.scss | echo > dist/style.css"
    style.css: ECHO is on. doesn't work as expected

  • Pipe with powershell

    Powershell: node ./bin/node-sass test/fixtures/compressed/index.scss | echo > style.css
    style.css: #navbar { [...]works as expected

  • Append with npm

    Npm script "build:css": "node-sass src/style.scss > dist/style.css"
    style.css: #navbar { [...]works as expected

What am I doing wrong?

Here some platform specs

  • NPM version (npm -v): 3.10.3
  • Node version (node -v): v6.3.0
  • Node Process (node -p process.versions): v6.3.0
  • Node Platform (node -p process.platform): win32
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):
    node-sass 4.5.3 (Wrapper) [JavaScript]
    libsass 3.5.0.beta.2 (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass): `-- [email protected]
1

There are 1 answers

1
Maurice van Cooten On

Try this:

"build:css": "node-sass --include-path scss src/style.scss dist/style.css"