-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add some automatic watch/build/serve goodness #654
Conversation
@@ -91,6 +95,11 @@ | |||
"pretest": "npm run build", | |||
"test": "npm run lint && karma start", | |||
"release": "./scripts/release.sh", | |||
"start": "grunt" | |||
"serve": "./scripts/open.js && parallelshell 'npm run watch' 'http-server -p 5678'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually make this a lot simpler. npm run watch & http-server -p 5678 -c-1 -o
-c-1
turns off caching. -o
tells http-server
to just open up the root of the web server which I think is fine I would rather have less dependencies.
You also don't need parallelshell
. If you need to run multiple commands at once. Just separate them with &
it works on both Mac and Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what i was doing wrong, but for some reason in my initial testing watch and http-server both needed their own shell. perhaps because i was using a double ampersand? either way, your suggestion is much cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the watcher and the server both need their own shell because they block subsequent commands from finishing so using &&
doesn't work but &
does. Here is a handy reference:
thing-1 && thing-2
- runthing-1
then runthing-2
thing-1 & thing-2
- runthing-1
andthing-2
at the same time and combine the output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both need their own shell because they block subsequent commands
word. thanks for taking the time to explain!
thx for the feedback @patrickarlt. i had a feeling my initial proposal was a bit dependency heavy and i appreciate the help cleaning it up. i've incorporated your feedback in a new commit and squashed everything down. i'll be happy to see #655 resolved after this gets merged. |
add some automatic watch/build/serve goodness
@jgravois http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/ is a really good reference. |
add some automatic watch/build/serve goodness
resolves #650
added a new script
npm run serve
which:src
directorydebug/sample.html
automagicallyif anyone has any better ideas than this approach, they'd be warmly received. whatever we end up shipping, i can lay down another commit later to make sure the README includes documentation.
cc/ @paulcpederson