Commit 32f7afc1 authored by Jinqn's avatar Jinqn

修改grunt,实现src代码改变,自动合并压缩,并刷新页面

parent 785e4438
/*global module:false*/ /*-----------------------------------------------------
* livereload Default Setting
*-----------------------------------------------------*/
'use strict';
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
/*-----------------------------------------------------
* Module Setting
*-----------------------------------------------------*/
module.exports = function (grunt) { module.exports = function (grunt) {
var banner = '/*!\n' + var banner = '/*!\n' +
...@@ -50,28 +59,54 @@ module.exports = function (grunt) { ...@@ -50,28 +59,54 @@ module.exports = function (grunt) {
}, },
uglify: { uglify: {
options: {
},
minimize: { minimize: {
files: { files: {
'dist/kityminder.all.min.js': 'dist/kityminder.all.js' 'dist/kityminder.all.min.js': 'dist/kityminder.all.js'
} }
} }
},
/* Start [Task liverload] ------------------------------------*/
livereload: {
port: 35729 // Default livereload listening port.
},
connect: {
livereload: {
options: {
hostname: '*',
port: 9001,
base: '.',
middleware: function(connect, options, middlewares) {
return [
lrSnippet,
connect.static(options.base.toString()),
connect.directory(options.base.toString())
]
}
}
}
},
regarde: {
js:{
files: 'src/**/*.js',
tasks: ['default', 'livereload']
}
} }
/* End [Task liverload] ------------------------------------*/
}); });
// These plugins provide necessary tasks. // These plugins provide necessary tasks.
/* [Build plugin & task ] ------------------------------------*/
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
// Build task(s).
// Default task.
grunt.registerTask( 'default', [ 'concat:js', 'uglify:minimize' ] ); grunt.registerTask( 'default', [ 'concat:js', 'uglify:minimize' ] );
/* [liverload plugin & task ] ------------------------------------*/
grunt.loadNpmTasks('grunt-regarde');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.registerTask('live', ['livereload-start', 'connect', 'regarde']);
}; };
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<script src="social.js" charset="utf-8"></script> <script src="social.js" charset="utf-8"></script>
<script src="../kity/dist/kitygraph.all.js" charset="utf-8"></script> <script src="../kity/dist/kitygraph.all.js" charset="utf-8"></script>
<script src="../configure.js" charset="utf-8"></script> <script src="../configure.js" charset="utf-8"></script>
<script src="../dist/dev.php" charset="utf-8"></script> <script src="./kityminder.all.min.js" charset="utf-8"></script>
<script src="../lang/zh-cn/zh-cn.js" charset="utf-8"></script> <script src="../lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<link href="../themes/default/css/import.css" type="text/css" rel="stylesheet"> <link href="../themes/default/css/import.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="social.css"> <link rel="stylesheet" href="social.css">
......
...@@ -33,7 +33,10 @@ ...@@ -33,7 +33,10 @@
"devDependencies": { "devDependencies": {
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-contrib-concat": "~0.3.0", "grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.2.6" "grunt-contrib-uglify": "~0.2.6",
"grunt-regarde": "latest",
"grunt-contrib-connect": "latest",
"grunt-contrib-livereload": "latest"
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment