Grunt: Unterschied zwischen den Versionen

Aus Open Source Ecology - Germany
Zur Navigation springen Zur Suche springen
(Created page with "* [http://gruntjs.com/getting-started Getting Started with Grunt], [http://stackoverflow.com/a/15712530/2510374 How to install grunt and how to built script with it] ** cd <yo...")
 
 
(11 dazwischenliegende Versionen von einem anderen Benutzer werden nicht angezeigt)
Zeile 1: Zeile 1:
 +
==Install==
 
* [http://gruntjs.com/getting-started Getting Started with Grunt], [http://stackoverflow.com/a/15712530/2510374 How to install grunt and how to built script with it]
 
* [http://gruntjs.com/getting-started Getting Started with Grunt], [http://stackoverflow.com/a/15712530/2510374 How to install grunt and how to built script with it]
 
** cd <your_project>
 
** cd <your_project>
Zeile 4: Zeile 5:
 
** touch package.json Gruntfile.js
 
** touch package.json Gruntfile.js
 
** npm install grunt --save-dev
 
** 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
 +
** [http://package.json.nodejitsu.com/ package.json - an interactive guide]
 +
* '''Gruntfile.js''' - defines, loads and configures Grunt tasks.
 +
** read a good explanation of a [http://gruntjs.com/sample-gruntfile Sample Gruntfile]
 +
 +
==Others==
 
* [http://www.anujgakhar.com/2013/02/28/writing-a-simple-grunt-task-using-gruntjs/ concatenate and minify your Javascript and CSS source files]
 
* [http://www.anujgakhar.com/2013/02/28/writing-a-simple-grunt-task-using-gruntjs/ concatenate and minify your Javascript and CSS source files]
 
* https://npmjs.org/package/grunt-frontend - minify CSS and JS
 
* https://npmjs.org/package/grunt-frontend - minify CSS and JS
Zeile 14: Zeile 36:
 
** https://github.com/gruntjs/grunt-contrib-livereload
 
** https://github.com/gruntjs/grunt-contrib-livereload
 
*** Dependency: npm install grunt-contrib-connect https://npmjs.org/package/grunt-contrib-connect
 
*** Dependency: npm install grunt-contrib-connect https://npmjs.org/package/grunt-contrib-connect
 +
 +
 +
See [[Bower]], [[Javascript]].
 +
[[Category: Software]]
 +
[[Kategorie:English pages]]

Aktuelle Version vom 25. August 2022, 18:26 Uhr

Install

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
    • package.json - an interactive guide
  • Gruntfile.js - defines, loads and configures Grunt tasks.

Others


See Bower, Javascript.