*ºÇ¾®¸Â¤ÎGrunt¼Â¹Ô¥µ¥ó¥×¥ë
´ðËܤμê½ç¤ò¤·¤Ã¤«¤ê³Ð¤¨¤Þ¤·¤ç¤¦¡ª
+Grunt¤ò¼Â¹Ô¤¹¤ë¥Ç¥£¥ì¥¯¥È¥ê¡Ê¢â ¥×¥í¥¸¥§¥¯¥È¥Ç¥£¥ì¥¯¥È¥ê¡Ë¤òºîÀ®¤·¤Æ¥¿¡¼¥ß¥Ê¥ë¤Ç³«¤¤Þ¤¹
+package.json¡Ê¢â ¥×¥í¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¡Ë¤ò¼«Æ°À¸À®¤·¤Þ¤¹
nmp init
+¥í¡¼¥«¥ë¤Ëgrunt¥â¥¸¥å¡¼¥ë¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤Þ¤¹
sudo npm install grunt --save-dev
+Gruntfile.js¡Ê¢â makefile¡Ë¤òºîÀ®¤·¤Þ¤¹
+Grunt¤ò¼Â¹Ô¤·¤Þ¤¹
grunt
°ú¿ô¤òÉÕ¤±¤Ê¤¤¤È¥¿¡¼¥²¥Ã¥È¤Ïdefault¤È¤Ê¤ê¤Þ¤¹¡£¡Ögrunt default¡×¤ÈƱ¤¸¤Ç¤¹¡£
~
¥Ç¥£¥ì¥¯¥È¥ê¡¦¥Õ¥¡¥¤¥ë¹½À®
#pre{{
Grunt¼Â¹Ô¥Ç¥£¥ì¥¯¥È¥ê ... ¢â ¥×¥í¥¸¥§¥¯¥È¥Ç¥£¥ì¥¯¥È¥ê
package.json ... ¢â ¥×¥í¥¸¥§¥¯¥È¥Õ¥¡¥¤¥ë¡£¡Önpm init¡×¤Ç¼«Æ°À¸À®
Gruntfile.js ... ¢â makefile¡£¼êÆ°¤ÇºîÀ®
node_modules ... ¡Ösudo npm install grunt --save-dev¡×¤Ê¤É¤Ç¼«Æ°À¸À®
grunt
*.*
}}
~
È÷¹Í¡§¡Ö--save-dev¡×¥ª¥×¥·¥ç¥ó¤Ë¤è¤ê¡¢¤É¤Î¥â¥¸¥å¡¼¥ë¤ò»ÈÍѤ·¤Æ¤¤¤ë¤«¤¬package.json¤ËÄɵ¤µ¤ì¤Þ¤¹¡£
node_modules¤òºï½ü¤·¤Æ¤â¡¢¤³¤Îpackage.json¤¬¤¢¤ì¤Ð¡¢Â¾¤Î´Ä¶¤Ç¤â¡Önpm install¡×¤È¤¹¤ì¤ÐƱ¤¸¤è¤¦¤Ë¥â¥¸¥å¡¼¥ë¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤Þ¤¹¡£
~
package.jsonÎã
#pre{{
{
"name": "projectFoo",
"version": "1.0.0",
"description": "",
"main": "Gruntfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"grunt": "^0.4.5"
}
}
}}
~
Gruntfile.jsÎã
#pre{{
module.exports = function(grunt) {
// config
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
});
// plugin
// tasks
grunt.registerTask('default', 'Log some stuff.', function() {
grunt.log.write('Logging some stuff...').ok();
});
};
}}
~
Gruntfile¤ÏCoffeeScript¤Ç¤âµ½Ò¤Ç¤¤Þ¤¹¡£
~
Gruntfile.coffee
#pre{{
module.exports = (grunt) ->
# config
grunt.initConfig
pkg: grunt.file.readJSON "package.json"
# plugin
# tasks
grunt.registerTask "default","Log some stuff.",() ->
grunt.log.write "Logging some stuff..."
}}
~
¥µ¥ó¥×¥ë¤Ç¤Î¡Ögrunt¡×¼Â¹Ô·ë²ÌÎã
Running "default" task
Logging some stuff...OK
Done, without errors.
»²¹Íurl: [[¥Ö¥é¥Ã¥¯¤ÊWeb³«È¯¸½¾ì¤ÎµßÀ¤¼ç¡¢Grunt¤Î¥¤¥ó¥¹¥È¡¼¥ë¤È»È¤¤Êý | @IT>http://www.atmarkit.co.jp/ait/articles/1403/04/news020.html]]
*¥ê¥ó¥¯
-[[¥³¥Ô¥Ú¤¬½ÐÍè¤ë¤Ê¤éï¤Ç¤â½ÐÍè¤ë¡¢WebÀ©ºî¥¿¥¹¥¯¼«Æ°²½¥Ä¡¼¥ë¡ÖGrunt¡×ƳÆþ¼ê½ç | OZPA¤Îɽ4>http://ozpa-h4.com/2014/02/06/grunt-js-install/]]
-[[Grunt¤Ç»Ï¤á¤ëWeb³«È¯Çú®¼«Æ°²½ÆþÌç¡Ê1¡Ë¡§¥Ö¥é¥Ã¥¯¤ÊWeb³«È¯¸½¾ì¤ÎµßÀ¤¼ç¡¢Grunt¤Î¥¤¥ó¥¹¥È¡¼¥ë¤È»È¤¤Êý | ¡÷IT>http://www.atmarkit.co.jp/ait/articles/1403/04/news020.html?fb_action_ids=495947923840680&fb_action_types=og.likes&fb_source=other_multiline&action_object_map=%5B407791856024072%5D&action_type_map=%5B%22og.likes%22%5D&action_ref_map=%5B%5D]]