GithubHelp home page GithubHelp logo

Comments (7)

keithamus avatar keithamus commented on August 17, 2024

Hey @janusch thanks for the issue.

Your first line should work fine. When you say "browser-sync does not pickup the changes" could you elaborate more?

from parallelshell.

janusch avatar janusch commented on August 17, 2024

@keithamus thanks for your quick reply!

browser-sync is like live reload, so it should recognized files changed by webpack and reload the browser. Somehow webpack repackages and browser-sync does nothing. This only occurs when the clean task is part of the script, otherwise it works fine.
For now I am using "start": "parallelshell 'npm run dev_watch' 'npm run dev'" this script and do not clean the folder on start anymore. I would prefer to clean before though.

I am not sure how to elaborate more, there is no error or log, sorry.

from parallelshell.

keithamus avatar keithamus commented on August 17, 2024

Why not run npm run clean before running npm run dev? e.g.

"start": "parallelshell 'npm run dev_watch' 'npm run clean && npm run dev'"

from parallelshell.

janusch avatar janusch commented on August 17, 2024

Thank you for looking into it!
I tried your proposed solution, but for whatever reason browser-sync does not trigger.

I think ill just keep the clean task out of the start script and go with "start": "parallelshell 'npm run dev_watch' 'npm run dev'"
I'll just run the clean script when i need it.

Btw, there is one thing that I am missing without gulp, maybe you have an idea on how to do that with a script. It is the gulp-inject task, where you can inject file references into an html file. This is useful for browser cache busting, I add a hash when the file changes.

Thanks again for your help!

from parallelshell.

keithamus avatar keithamus commented on August 17, 2024

I typically use a templating language, such as Handlebars and pass the template some JSON (either through the cli if it allows it, otherwise I'll write a bit of JS). This is generally much more flexible than something like gulp-inject, and scales well for when your project gets bigger.

See https://github.com/keithamus/npm-scripts-example/blob/master/package.json#L36 for an example of this.

If you really want to stick with gulp-inject style regexp replacement, then try keithamus/npm-scripts-example#22

from parallelshell.

paulpflug avatar paulpflug commented on August 17, 2024

could be a problem of browser-sync.
Maybe it watches for file changes, but when the file gets deleted the watcher vanishes also. The only workaround is to watch the whole folder and filter the change events..

I had a similar problem when a file watcher didn't fire on changes of a compiled js file for the same reason. When compiling from coffeescript, the js gets deleted and the watcher too πŸ˜„

from parallelshell.

janusch avatar janusch commented on August 17, 2024

Interesting, @paulpflug thanks for your reply!
I think with this we can safely close this issue.

from parallelshell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.