auth0-blog / react-flux-jwt-authentication-sample

Sample for implementing Authentication with a React Flux app and JWTs
589 stars 102 forks source link

How does your watch-css npm script work? I get an error trying to find rework-npm. #2

Closed ryancole closed 9 years ago

ryancole commented 9 years ago

I'm trying to issue the watch-css npm script. I get an error saying that rework-npm is not a valid command. I can run rework-npm through command line just fine, though. I don't think nodemon is able to run it, though?

ryancole commented 9 years ago

Ah, I'm on Windows. I don't think this pipe feature is available.

mgonto commented 9 years ago

Ohh sorry about that. Let me know if you find a solution for that in Windows!

ryancole commented 9 years ago

I actually found a way that works on both linux and windows. The actual issue, originally, was that the watch-css npm task was using single quotes, which didn't work on Windows. So, changing those to escaped double quotes fixed the watch-css task.

Another problem came up though, being that I couldn't figure out how to run multiple npm tasks in parallel on Windows. On Linux, everybody just uses the ampersands. On Windows, I got this to work by using another npm module - npm-run-all.

So, with those two adjustments, I've got this scripts section working well on both Linux and Windows ...

  "scripts": {
    "build": "npm-run-all --parallel build-js build-css",
    "watch": "npm-run-all --parallel watch-js watch-css",
    "build-js": "browserify src/app.jsx | uglifyjs > build/app.js",
    "build-css": "rework-npm index.css | cleancss -o build/app.css",
    "watch-js": "watchify src/app.jsx -o build/app.js --debug --verbose",
    "watch-css": "nodemon -e css --ignore build --exec \"rework-npm index.css -o build/app.css\""
  }
mgonto commented 9 years ago

That's awesome :).

Are you willing to send a PR with this?

Thanks!