grunt

Reading time ~1 minute

最近使用了下Grunt和WebPack,这里总结下使用中的一些问题。

Part1 版本问题

安装grunt-contrib-image提示

WARN node unsupported "[email protected]" is incompatible with
[email protected][email protected][email protected][email protected][email protected][email protected]^5.0.0, expected [email protected]>=0.10.0 <7

imagemin安装版本v2.0.1,期望的版本是[email protected]>=0.10.0 <7 与8.9.3不匹配,这个警告并不影响imagemin的使用,配置好image插件之后,输入grunt命令就自动执行压缩

配置如下

	imagemin: {
	  dist: {
	    options: {
	      optimizationLevel: 6,
	      progressive: true
	    },
	    files: [{
	      expand: true,
	      cwd: 'images/',
	      src: '{,*/}*.{png,jpg,jpeg,ico}',
	      dest: 'images/'
	    }]
	  }
	}

Part2 配置说明

配置插件选项的说明的一些链接,以便于之后配置使用

jshint: https://jshint.com/docs/options/

其他大部分可以在npmjsgrunt搜索找到说明或在github的readme中,部分链接如下:

concat: https://github.com/gruntjs/grunt-contrib-concat

uglify;https://www.npmjs.com/package/grunt-contrib-uglify

htmlmin: https://www.npmjs.com/package/grunt-contrib-htmlmin

CSS3载入特效 charpter1

Published on January 29, 2018

4. javascript数组

Published on January 27, 2018