1 Grunt Installing the global installation NPM install-g GRUNT-CLI
2 configuration package.json
and Gruntfile
files, these two files must be located under the project root directory.
Package.json Configuration Instance
1 {2"Name": "Web",3"Version": "2.1.0",4"description": "A simple UI Framework based on Zepto",5"Author": "Vistim",6"License": "BSD",7"Readmefilename": "Readme.md",8"Devdependencies": {9"Connect-livereload": "Latest",Ten"Grunt": "^1.0.1", One"Grunt-contrib-concat": "^1.0.1", A"Grunt-contrib-connect": "^1.0.2", -"Grunt-contrib-copy": "^1.0.0", -"Grunt-contrib-imagemin": "^0.8.1", the"Grunt-contrib-jshint": "^0.12.0", -"Grunt-contrib-less": "^1.3.0", -"Grunt-contrib-livereload": "^0.1.2", -"Grunt-contrib-uglify": "^1.0.1", +"Grunt-contrib-watch": "^1.0.0", -"Grunt-jsbint": "0.0.7", +"Grunt-size": "^0.1.2", A"grunt-targethtml": "^0.2.6", at"Grunt-tmod": "^0.2.10" - } -}
3 Running Grunt
Move the current directory of the command line to the project's root directory. Command-line operation "CD" + path enter into the directory. Access to desktop via CD desktop
Executes npm install
the library that the Command installation project relies on. (can be automatically installed directly according to the configuration file)
Executes the grunt
command.
4 grunt commonly used plug-in function (in Package.json there is the use of plug-in list and version number)
Contrib-jshint--javascript syntax error checking;
contrib-watch--real-time monitoring file changes, call the corresponding task re-execution;
contrib-clean--empty files and folders;
contrib-uglify--compressing JavaScript code
contrib-copy--Copying files, folders
contrib-concat--merging multiple files into a single file
karma--front-end automated testing tools
Grunt Learning Essays