mkdir grunt-say
cd grunt-say
create file package.json, Gruntfile.js, index.html
npm install
grunt
browse http://localhost:9001
index.html file change and save
say live reload ! wow!!
mkdir grunt-say
cd grunt-say
create file package.json, Gruntfile.js, index.html
npm install
grunt
browse http://localhost:9001
index.html file change and save
say live reload ! wow!!
'use strict'; | |
var path = require('path'); | |
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; | |
var folderMount = function folderMount(connect, point) { | |
return connect.static(path.resolve(point)); | |
}; | |
module.exports = function (grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
exec: { | |
start: { | |
command: 'say grunt start!' | |
}, | |
startlivereload: { | |
command: 'say livereload start!' | |
}, | |
onlivereload: { | |
command: 'say livereload wow!!' | |
} | |
}, | |
connect: { | |
livereload: { | |
options: { | |
port: 9001, | |
middleware: function(connect, options) { | |
return [lrSnippet, folderMount(connect, '.')] | |
} | |
} | |
} | |
}, | |
// Configuration to be run (and then tested) | |
regarde: { | |
fred: { | |
files: '*.html', | |
tasks: ['livereload', 'exec:onlivereload'] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-regarde'); | |
grunt.loadNpmTasks('grunt-contrib-connect'); | |
grunt.loadNpmTasks('grunt-contrib-livereload'); | |
//grunt-exec load | |
grunt.loadNpmTasks('grunt-exec'); | |
grunt.registerTask('default', ['exec:start', 'livereload-start', 'exec:startlivereload', 'connect', 'regarde']); | |
}; |
<!DOCTYPE HTML> | |
<html lang="ja_JP"> | |
<head> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
Live reload now!! | |
</body> | |
</html> |
{ | |
"name": "grunt-say-hello", | |
"version": "0.1.0", | |
"Dependencies": {}, | |
"devDependencies": { | |
"grunt": "~0.4.0", | |
"grunt-contrib-connect": "~0.1.2", | |
"grunt-contrib-livereload": "~0.1.1", | |
"grunt-regarde": "~0.1.1", | |
"grunt-exec": "~0.4.0" | |
} | |
} |
livereload wow!! lol