Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

If watching, initially compile #1369

Closed
corysimmons opened this issue Feb 5, 2016 · 8 comments
Closed

If watching, initially compile #1369

corysimmons opened this issue Feb 5, 2016 · 8 comments

Comments

@corysimmons
Copy link

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 ./"
  }

@xzyfer
Copy link
Contributor

xzyfer commented Feb 9, 2016

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.

@corysimmons
Copy link
Author

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?

@xzyfer
Copy link
Contributor

xzyfer commented Feb 9, 2016

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 ./",

@corysimmons
Copy link
Author

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

Not DRY.

Meh.

@jhildenbiddle
Copy link

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"
}

@ohxyz
Copy link

ohxyz commented Nov 27, 2019

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.

@jakobrosenberg
Copy link

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?

@rockneverdies55
Copy link

"watch" should be building first then waiting for the updates to rebuild.

jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this issue Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants