Skip to content

Instantly share code, notes, and snippets.

@jonschlinkert
Created November 18, 2012 23:35
Show Gist options
  • Save jonschlinkert/4108159 to your computer and use it in GitHub Desktop.
Save jonschlinkert/4108159 to your computer and use it in GitHub Desktop.
grunt-reload-watch
<html>
<head>
<title>For testing javascript</title>
<script src="console.js"></script>
</head>
<body>
<p>Run grunt, then open this file at the localhost/server initialized by the gruntfile. You should now see real-time, live updates whenever you edit and save either the HTML or js file.</p>
</body>
</html>
// test code here
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
lint:{
files:['console.js']
},
// Reload browswer when files change
reload: {
proxy: {}
},
server: {
port: 8000
},
trigger: {
watchFile: 'console.js'
},
// Watch and reload files in the browser
watch:{
console: {
files: ['console.html','console.js'],
tasks: 'reload'
},
test: {
files: ['console.html','console.js'],
tasks: 'reload trigger'
}
}
});
// Register npm tasks
grunt.loadNpmTasks('grunt-reload');
// Default task.
grunt.registerTask('default', 'server reload watch:console');
};
{
"name": "grunt-reload-boilerplate",
"description": "Simple boilerplate for initializing html/css/js projects that require live browser reloading.",
"version": "0.1.0",
"homepage": "https://github.com/jonschlinkert/grunt-reload-boilerplate",
"author": {
"name": "Jon Schlinkert",
"email": "github@sellside.com"
},
"repository": {
"type": "git",
"url": "https://github.com/jonschlinkert/grunt-reload-boilerplate.git"
},
"bugs": {
"url": "https://github.com/jonschlinkert/grunt-reload-boilerplate/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/jonschlinkert/grunt-reload-boilerplate/blob/master/LICENSE-MIT"
}
],
"main": "lib/grunt-reload-boilerplate",
"engines": {
"node": ">= 0.6.0"
},
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"grunt": "~0.3.17"
},
"keywords": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment