☀【Grunt】package.json, Gruntfile.js, npm install, grunt
2013-11-28 09:52
591 查看
npm install --registry http://registry.npm.taobao.org/ 切换源
Grunt.js 在前端项目中的实战 http://beiyuu.com/grunt-in-action/
grunt.registerTask('default', ['less', 'watch']);
grunt build
grunt.registerTask('build', ['htmlmin', 'uglify', 'cssmin', 'imagemin']);
grunt live
grunt.registerTask('live', ['livereload-start', 'connect', 'regarde']);
xp系统node_modules里文件目录层级太深不能删除需要把文件剪切出来删除
Grunt.js 在前端项目中的实战 http://beiyuu.com/grunt-in-action/
package.json
{ "name": "my-project-name", "version": "0.1.0", "devDependencies": { "grunt": "~0.4.1", "grunt-contrib-htmlmin": "~0.1.3", "grunt-contrib-cssmin": "~0.6.1", "grunt-contrib-uglify": "~0.2.2", "grunt-contrib-imagemin": "~0.1.4", "grunt-regarde": "latest", "grunt-contrib-connect": "latest", "grunt-contrib-livereload": "latest" } }
Gruntfile.js
module.exports = function(grunt) { grunt.initConfig({ sass: { compile: { files: { 'css/core.css': ['css/core.scss'] } } }, cssmin: { combine: { files: { 'css/core.css': ['css/core.css'] } } }, uglify: { options: { mangle: false }, build: { files: { 'js/core.js': ['js/core.js'] } } }, imagemin: { dist: { options: { optimizationLevel: 3 }, files: [{ expand: true, cwd: 'imgsss/', src: ['**/*.{png,jpg,jpeg}'], dest: 'imgssss/' }] } }, watch: { scripts: { files: [ 'css/*.scss', 'js/*.js' ], tasks: ['sass', 'cssmin', 'uglify'] } } }); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-imagemin'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ['sass', 'cssmin', 'uglify', 'imagemin', 'watch']); };
npm install
grunt
gruntgrunt.registerTask('default', ['less', 'watch']);
grunt build
grunt.registerTask('build', ['htmlmin', 'uglify', 'cssmin', 'imagemin']);
grunt live
grunt.registerTask('live', ['livereload-start', 'connect', 'regarde']);
xp系统node_modules里文件目录层级太深不能删除需要把文件剪切出来删除
相关文章推荐
- node npm grunt工具 package.json Gruntfile.js相关
- package.json, Gruntfile.js等文件配置
- 使用grunt-init自动创建gruntfile.js和package.json文件
- npm WARN enoent ENOENT: no such file or directory, open 'E:\Program Files\nodejs \package.json' npm
- npm WARN enoent ENOENT: no such file or directory, open 'E:\Program Files\nodejs \package.json' npm
- npm WARN enoent ENOENT: no such file or directory, open 'E:\Program Files\nodejs \package.json' npm
- npm WARN enoent ENOENT: no such file or directory, open 'E:\Program Files\nodejs \package.json' npm
- npm WARN enoent ENOENT: no such file or directory, open 'E:\Program Files\nodejs \package.json' npm
- npm WARN enoent ENOENT: no such file or directory, open 'E:\Program Files\nodejs \package.json' npm
- npm WARN enoent ENOENT: no such file or directory, open 'C:\Program Files\nodejs \package.json'
- npm WARN enoent ENOENT: no such file or directory, open 'E:\Program Files\nodejs \package.json' npm
- nodejs npm package.json中文文档
- Node.js 安装第三方模块包(npm),通过 package.json配置信息安装项目依赖的模块
- npm WARN enoent ENOENT: no such file or directory, open 'D:\web\Imooc\package.json' npm WARN Imooc
- npm install 生成的package-lock.json作用
- [Node.js] Configuring npm package.json scripts
- mac os npm WARN saveError ENOENT: no such file or directory, open '/Users/summer/package.json'
- npm ERR! code ENOLOCAL Could not install from "" as it does not contain a package.json file.解决
- nodejs npm package.json中文文档
- 关于gulpfile.js和package.json