We have do something smarter and automate with grunt after JS optimization. Let's install "grunt-contrib-watch" that run predefined tasks whenever watched file patterns are added, changed or deleted. How to install ? 1. Run " npm install grunt - contrib - watch --save-dev" in ur project location. 2. Add " grunt . loadNpmTasks ( 'grunt-contrib-watch' );" in Gruntfile.js loated in ur project location. Gruntfile.js - The sample use Closure complier to optimize JS file. »see more module.exports = function(grunt) { grunt.initConfig({ file: { min: { dest: 'js/opt/min.js', src: [ 'js/jquery.tools/overlay/overlay.js', 'js/jquery.tools/scrollable/scrollable.js', ] } }, 'closure-compiler': { min: { closurePath:'/Library/closure/', ...
一個網頁設計師經驗分享部落格,內容涵蓋HTML, CSS, RWD, Nodejs, React 的技術。