How can I get node-sass watch and live reload to work from a single NPM script?

后端 未结 6 1477
面向向阳花
面向向阳花 2021-01-02 23:30

Taking the following scripts section from a package.json:

\"scripts\":{
    \"sass:watch\": \"npm run sass -- -w ./src/public/stylesheets -r --s         


        
6条回答
  •  太阳男子
    2021-01-02 23:52

    AFAIK, you can't, in a useful way.

    You could push one task to the background by appending & to its command line, but that would keep the task running even when you ^C to stop the running NPM task.

    Alternatively, you can call npm run ... twice and bg one:

    $ npm run sass:watch &
    $ npm run livereload
    

    But that's pretty messy too IMO.

    If you want this sort of thing, consider using gulp.

提交回复
热议问题