Node-sass: If watching, initially compile

3

I'm using the cli in npm scripts. I want to watch stuff, but when I do, it doesn't initially trigger. It would be nice if it did, or if you're concerned about XYZ, at least offer a flag like --initial.

This would make it so I didn't have to have 2 scripts:

"scripts": {
    "start": "npm-run-all styles:compile-sass styles:watch-sass",
    "styles:compile-sass": "node-sass style.scss > style.css",
    "styles:watch-sass": "node-sass -w style.scss -o ./"
  }

:x:

corysimmons picture corysimmons  ·  5 Feb 2016

Most helpful comment

19

Who is "we"? Sure you don't want to open this up to community discussion since it seems like a rather easy change that I'm sure a lot of people who use npm scripts would really appreciate?

corysimmons picture corysimmons  ·  9 Feb 2016

All comments

-12

We have no plans to do this. We believe it's an unnecessary compilation to our CLI for a niche usecase. Your current solution is fine.

xzyfer picture xzyfer  ·  9 Feb 2016
19

Who is "we"? Sure you don't want to open this up to community discussion since it seems like a rather easy change that I'm sure a lot of people who use npm scripts would really appreciate?

corysimmons picture corysimmons  ·  9 Feb 2016
0

Who is "we"?

We are the maintainers of the this project.

it seems like a rather easy change

Every new feature adds complexity and a maintenance burden for us. We weigh up the usefulness, and demand for a feature against the complexity, and ongoing support cost.

that I'm sure a lot of people who use npm scripts would really appreciate

To be frank, if you're going to give the convenience of asset pipelines for something more low level like npm scripts, it's unreasonable to expect package authors to take on the work of making things convenient again.

We believe it's an unnecessary compilation to our CLI

What you're asking for is very trivially achieved using simple scripting.

    "styles:dev": "node-sass style.scss > style.css && node-sass -w style.scss -o ./",
xzyfer picture xzyfer  ·  9 Feb 2016
0

What you're asking for is very trivially achieved using simple scripting.

Not DRY.

Meh.

corysimmons picture corysimmons  ·  9 Feb 2016
12

Both sides seem reasonable to me.

@corysimmons: You can remain DRY by leveraging NPM's custom script arguments:

"scripts": {
  "build:sass": "node-sass -r --output-style compressed src/style.scss -o dist",
  "watch:sass": "npm run build:sass && npm run build:sass -- -w"
}
jhildenbiddle picture jhildenbiddle  ·  27 Jul 2016
0

Still looking forward to this feature. Would be handy if watch multiple files across different paths. Could save lots of lines in package.json. Still appreciate the effort from maintainers and communities.

ohxyz picture ohxyz  ·  27 Nov 2019
8

I can't understand why this feature isn't enabled by default, let alone not available.

Is there a single scenario where an initial build is unwanted?

jakobrosenberg picture jakobrosenberg  ·  26 Feb 2020