快速搭建fineui开发环境。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

121 lines
3.2 KiB

module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
concat: {
options: {
separator: ""
},
bundleJs: {
src: [
"src/modules/**/*.js",
"src/index.js"
],
dest: "dist/bundle.js"
},
bundleCss: {
src: ["src/css/**/*.css"],
dest: "dist/bundle.css"
}
},
less: {
main: {
expand: true,
cwd: "src/modules",
src: ["**/*.less"],
dest: "src/css/",
ext: ".css"
},
dev: {
options: {
compress: true,
yuicompress: false
}
}
},
uglify: {
options: {
banner:
"/*! <%= pkg.name %> <%= grunt.template.today(\"dd-mm-yyyy\") %> */\n"
},
dist: {
files: {
"dist/bundle.min.js": ["<%= concat.bundleJs.dest %>"]
}
}
},
cssmin: {
bundleCss: {
src: "<%= concat.bundleCss.dest %>",
dest: "dist/bundle.min.css"
}
},
jshint: {
files: ["src/**/*.js"],
options: {
globals: {
$: true,
jQuery: true,
console: true,
module: true,
document: true
},
browser: true,
expr: true
}
},
watch: {
scripts: {
files: ["src/**/*.js", "src/**/*.less"],
tasks: ["less", "concat"],
options: {
spanw: true,
interrupt: true
}
},
livereload: {
options: {
livereload: "<%= connect.options.livereload %>"
},
files: ["src/**/*.js", "src/**/*.less"]
}
},
connect: {
options: {
port: 9000,
open: true,
livereload: 35799,
// Change this to '0.0.0.0' to access the server from outside
hostname: "localhost"
},
server: {
options: {
port: 9009,
base: "./"
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.registerTask("default", [
"jshint",
"less",
"concat",
"connect",
"watch"
]);
grunt.registerTask("min", ["less", "concat", "uglify", "cssmin"]);
};