- .modernizr原理,就是判断是否支持某个css3、html5特性,支持做支持的事。不支持,做不支持的。
如何获取modernizr
ps:官网对modernizr进行了拆分,支持开发根据项目需要的特性,进行配置modernizr,这样可以加速modernizr加载速度。1.官网:https://modernizr.com/download
2.安装modernizr命令行工具:
npm install -g modernizr(全局安装)
推荐在项目路径下安装,当然利用grunt开发的话,完全可以配置到package.json中,利用npm install 进行局部安装。
如果都安装完成了,仅仅需要安装grunt-modernizr,完全可以利用npm install grunt-modernizr –save-only=dev 进行安装。
package.json举例:
{
"name": "hellworld",
"version": "1.0.0",
"description": "hello world",
"main": "index.js",
"scripts": {
"test": "test"
},
"author": "author",
"license": "ISC",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.4.1",
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-cssmin":"*