Grunt: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 18: | Zeile 18: | ||
==Structure== | ==Structure== | ||
− | * '''package.json''' - | + | * '''package.json''' - contains various metadata about an Node Packaged Modules. Project identification and description, project's dependencies, ... |
** dependencies field is used to list all the dependencies of your project that are available on npm | ** dependencies field is used to list all the dependencies of your project that are available on npm | ||
** devDependencies are dependencies not required for normal operation, but required/recommended if you want to patch or modify the project. E.g. testing framework | ** devDependencies are dependencies not required for normal operation, but required/recommended if you want to patch or modify the project. E.g. testing framework | ||
− | + | * '''Gruntfile.js''' - defines, loads and initializes/configures Grunt tasks. | |
+ | ** read a good explanation of a [http://gruntjs.com/sample-gruntfile Sample Gruntfile] | ||
==Others== | ==Others== |
Version vom 19. August 2013, 11:27 Uhr
Install
- Getting Started with Grunt, How to install grunt and how to built script with it
- cd <your_project>
- npm install -g grunt-cli
- touch package.json Gruntfile.js
- npm install grunt --save-dev
Use in a new Grunt project
- npm install
- read all the module dependencies from package.json and install them from npm software repository into the local folder node_modules.
- grunt
- runs the default registered task in Gruntfile.js.
Installing Grunt and gruntplugins:
- npm install <module> --save-dev
- installs the module locally and adds it to the devDependencies section of package.json, using a tilde version range
Structure
- package.json - contains various metadata about an Node Packaged Modules. Project identification and description, project's dependencies, ...
- dependencies field is used to list all the dependencies of your project that are available on npm
- devDependencies are dependencies not required for normal operation, but required/recommended if you want to patch or modify the project. E.g. testing framework
- Gruntfile.js - defines, loads and initializes/configures Grunt tasks.
- read a good explanation of a Sample Gruntfile
Others
- concatenate and minify your Javascript and CSS source files
- https://npmjs.org/package/grunt-frontend - minify CSS and JS
- grunt-contrib-jade - compiles Jade html language
- Jade Readme Contents
- npm install grunt-contrib-jade --save-dev
- simplemon - Simple file monitor that executes commands whenever a file change occurs
- simplemon -O jade html_templates jade_templates
- http://livereload.com/
- https://github.com/gruntjs/grunt-contrib-livereload
- Dependency: npm install grunt-contrib-connect https://npmjs.org/package/grunt-contrib-connect
- https://github.com/gruntjs/grunt-contrib-livereload