Node-sass: Make node-sass --watch compile on startup

Created on 9 Oct 2016  路  9Comments  路  Source: sass/node-sass

When node-sass is run with --watch, it does not compile until a change is detected. This is inconvenient in a couple of cases.

First, if a project has never been built, it is necessary to first run node-sass to compile, and then run node-sass --watch to commence watching. Second, if changes were made to files before the user ran node-sass --watch, those changes will not be reflected until another change is made. Similar to the first case, the user may need to run node-sass first to compile and then run node-sass --watch to commence watching.

The solution is to make node-sass --watch compile on startup. This is not a major inconvenience, but it would be a nice feature to have

All 9 comments

I'll add that chaining the commands and using npm scripts pretty much makes this a non-issue from a usability perspective. But since there are no apparent drawbacks to compiling on startup, doing so seems like the more sensible default and the behavior most users would expect

This is a great idea! At work a few co-workers are always confused when they install a new project.

This has been discussed in the passed, most recently in #1660. There is no way to please everyone.

Will not be changing the current behaviour. The current behaviour a result of complaints about the behaviour you're suggesting. At the end of the day, you can easily achieve what you're asking for with two CLI commands, where as there would be no way achieve the current behaviour if compile happened on watch.

How about including a --build-on-start flag, If a PR was made would it be accepted?

I understand the reasoning behind not doing it, however having to duplicate commands can lead to issues. (You need to remember to update two commands each time a change is made).

Would there be an appetite for such a PR?

@McPo I appreciate your position but we are not open to such a PR at the time being. In my opinion adding extra flags is not the solution. Complicating the CLI moves the potential for bugs from a users script, to node-sass itself which can affect all users.

In v4 we may approach this differently by adding some kind of --build flag, which could be added with --watch to achieve the desired behaviour.

@xzyfer we are now in v4. Should this feature be considered? I mean, --build sounds great! 馃槃

@xzyfer Your statements seem to be contradictory:

In my opinion adding extra flags is not the solution.

and

In v4 we may approach this differently by adding some kind of --build flag, which could be added with --watch to achieve the desired behaviour.

In any case, while I would also prefer compile-on-start, --build seems okay. I'm trying to reduce the number of little gotchas in my build system (of which there are already plenty) and this one took me by surprise as well.

Could be considered @xzyfer? A little --build option would be useful. Please, think about it!

Any advance of this issue? @xzyfer????

Was this page helpful?
0 / 5 - 0 ratings