Watch is a project mainly written in JavaScript, it's free.
script/css reloader
h1. Watch
Watch is a script reloader. Watch monitors local Javascript and CSS files for changes and automatically reloads the modified file in your browser.
Examples:
Watch all CSS files for changes and reload them:
<script>_watch.css("*");</script>
Watch 1 Javascript file for changes and reload it:
<script>_watch.js("test.js");</script>
In this next example, test.js
is a custom library that leaks 2 variables into the global namespace. We'll pass watch
a cleanup
function to remove the global variables (optional), and then a reinitialize
function to reinit the test.js
library.
Watch 1 Javascript file for changes, run a cleanup
, reload the script, then run reinit
:
<script> _watch.js( "test.js", function () { //cleanup delete window.testGlobal1; delete window.testGlobal2; }, function () { //reinit test.init(); } ); </script>
h3. Updates
Follow "@markmarkoh":http://twitter.com/markmarkoh for updates.
h3. Dependencies
The following needs to be installed to run watch:
Watch requires the following libraries, which should install automatically:
h2. Installation
npm install watch.js -g
h3. Alternative Installation (from source)
git clone [email protected]:markmarkoh/watch.git watch cd watch npm install . -g
h2. Running Watch
In the Terminal, change directory to the server root
cd ~/programs/web/sample watchjs
Alternatively:
watchjs path/to/static/resources
If everything is working, you should see a message like this:
Staring Watch.js server... Watch.js server started on port 7202 Add <script src="http://localhost:7202/watch.js"></script> to your HTML
Add that script to the bottom of your HTML document. Refer to the 'Examples' above for making API calls.
h4. Licence (GPL)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see "http://www.gnu.org/licenses/":http://www.gnu.org/licenses/.