首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

批改 HTML JS CSS 等文件浏览器自动刷新

2014-01-05 
修改 HTML JS CSS 等文件浏览器自动刷新module.exports function (grunt) {var LIVERELOAD_PORT 35729

修改 HTML JS CSS 等文件浏览器自动刷新
module.exports = function (grunt) { var LIVERELOAD_PORT = 35729; // lrSnippet is just a function. // It's a piece of Connect middleware that injects // a script into the static served html. var lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT }); // All the middleware necessary to serve static files. var livereloadMiddleware = function (connect, options) { return [ // Inject a livereloading script into static files. lrSnippet, // Serve static files. connect.static(options.base), // Make empty directories browsable. connect.directory(options.base) ]; }; grunt.initConfig({ connect: { client: { options: { port: 9001,hostname: '0.0.0.0', base: 'src/',middleware: livereloadMiddleware } } }, watch: { client: { files: ['src/**/*'], tasks: [], options: { livereload: true }} } }); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('preview', ['connect:client', 'watch:client']);};

热点排行