my best grunt

25
オレの最強の Gruntfile 1356日月曜日

Upload: daichi-morifuji

Post on 27-Jan-2015

115 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: My best grunt

オレの最強のGruntfile

13年5月6日月曜日

Page 2: My best grunt

@muddydixongithub.com/muddydixon

13年5月6日月曜日

Page 3: My best grunt

Gruntis

Task Runner13年5月6日月曜日

Page 4: My best grunt

とんでもないレベルにまでエコシステムが発達したTask Runner

Grunt

13年5月6日月曜日

Page 5: My best grunt

Grunt

13年5月6日月曜日

Page 6: My best grunt

Gruntcontrib / contrib-clean / contrib-coffee / contrib-compass / contrib-compress / contrib-concat / contrib-connect / contrib-copy / contrib-csslint / contrib-cssmin / contrib-handlebars / contrib-htmlmin / contrib-imagemin / contrib-jade / contrib-jasmine / contrib-jshint / contrib-jst / contrib-less / contrib-livereload / contrib-mincss / contrib-nodeunit / contrib-qunit / contrib-requirejs / contrib-sass / contrib-stylus / contrib-uglify / contrib-watch / contrib-yuidoc / amd-doc / assemble / assemble-less / assemble-package-manager / assemble-utils / assetflow / atpackager / bbb / build-bootstrap / can-compile / coffee2closure / config-heroku / connect-modrewrite / dp-contrib-copy / enyo / fe / aggregator / akamai-clear / amd-check / amd-checkrequire / amd-dist / amd-doc / amd-test / anglebars / angular-annotator / angular-seed / angular-templates / angular-templates-amd / angular-verifybuild / annotated-requirejs / ant-sfdc / apidoc / append-sourcemapping / append-templates / asciify / asset-mapper / asset-revisions / assetify / assetpush / assets-revving / assets-versioning / at-class / autoprefixer / aws / backbone-routes / backbonebuilder / bake / banner / barista / barkeep / batman-template / bbb-requirejs / bbb-server / bbb-styles / beautify / behat / bem / benchmark / bg-shell / blanket / bless / blink1 / blueprints / bom / bookmarklet-thingy / bootstrap / booty / bower / bower-concat / bower-config / bower-hooks / bower-install / bower-organiser / bower-requirejs / bower-task / bowerful / browserify / browserify2 / browserstack / build-docs / build-gh-pages / build-requirejs / buildconcat / buildfiles / bump / bumpup / bumpx / buster / buster-plugin / bvitk-tools / cachebuster / cafe-mocha / casper / casperjs / cat / cdn / cdn-refresh / changelog / check-modules / check-online / chmod / chrome-manifest / clean / cleanx / clear / client-compiler / clientside / closure-compiler / closure-linter / closure-soy / closure-tools / closure-wrap / closurecompiler / cloudfiles / cloudfront-clear / cmd-combo / cmd-concat / cmd-transport / cms-site-scaffold / cms-upload / coffee / coffee-coverage / coffee-percolator / coffee-redux / coffee-server / coffeecup / coffeeify / coffeelint / combine / comment-media-queries / commonjs / commonjs-handlebars / compile-handlebars / complexity / compliment / component / component-build / concat / concat-sourcemap / concurrent / config / connect / connect-proxy / connect-rewrite / consolidate-css / context / contrib / contrib-clean / contrib-coffee / contrib-compass / contrib-compress / contrib-concat / contrib-connect / contrib-copy / contrib-csslint / contrib-cssmin / contrib-handlebars / contrib-htmlmin / contrib-imagemin / contrib-jade / contrib-jasmine / contrib-jshint / contrib-jst / contrib-less / contrib-livereload / contrib-mincss / contrib-nodeunit / contrib-qunit / contrib-requirejs / contrib-sass / contrib-stylus / contrib-uglify / contrib-watch / contrib-yuidoc / couch / couchapp / coverjs / cp / crane / crusher / crx / css / css-amd / css-collect / css-combo / css2js / cssc / csscss / cssjoin / csso / cssrb / cucumber / curl / customize-bootstrap / data-uri / dawg / dep-concat / dependencygraph / dependo / devcode / develop / devserver / devtools / dir2json / docco / docker / docs / docsitebuilder / docular / dojo / dom-munger / dot / dot-compiler / dot-precompile / dotjs / dotlit / download / dox / drush / dss / dust / dust-html / dustjs / eco / eco-amd / ect / ect-templates / eiffel / email-builder / ember-handlebars / ember-templates / emberify / emblem / encase / ender / env / es6-module-transpiler / esmangle / este / exec / exists / express / express-bootstrap / express-server / extdeps / extendscript / fail / fenbi-tasks / fest / file-creator / file-regex-rename / filesize / fileslist / fingerprint / flyway / forever / frontend / fscss / ftp-deploy / functional / furnace / fuse / gcc / ghost / gint / git / git-authors / git-contributors / git-describe / gitco / github-pages / gjslint / global-config / glue / groc / groundskeeper / growl / grunticon / grunticon-highrespng / grunticon-sass / grunticon-stylus / gss-pull / haml / handlebars-compiler / handlebars-custom / handlebars-js / handlebars-requirejs / handlebars-seajs / handlebars-static / hapi / hash / hashmap / hashres / haxe / heroku-deploy / hogan / hogan-client / hoganjs / html / html-annotation / html-build / html-builder / html-json-wrapper / html-prettyprinter / html-smoosher / html-snapshot / html-validation / html2js / html2json / htmlbuild / htmlcompressor / htmlgen / htmlhint / htmlrefs / httpcopy / hub / hug / hull-widgets / hustler / iced-coffee / iconv / ie9-selector-counter / image-embed / image-normalize / imagemagick / images / imagine / imgmin / imgo / importsrc / include / include-bootstrap / include-replace / include-replace-cwd / includes / indent / init-browser / init-gruntplugin2 / init-init / init-mootools / init-plugin / inline-assets / inline-css / install-dependencies / install-init / invalidate-cloudfront / iron-worker / istanbul / it / itv / jade / jade-handlebars / jade-plugin / jaded / jam / jasmine / jasmine-coverage / jasmine-html-runner / jasmine-html-spec-runner / jasmine-node / jasmine-node-lite / jasmine-node-task / jasmine-runner / jasmine-spec-server / jasmine-task / jassi / java-properties / jekyll / jenkins / jetrunner / jquery-content / jquery-json / jquerybuilder / jquerytransform / jsbeautifier / jsdoc / jsdoc-plugin / jsduck / jshint2 / jsio / jslint / jsmin-sourcemap / json / json-minify / json-schema / jsonlint / jsonmin / jssemicoloned / jstemplater / jstestdriver / jstools / jsttojs / jsvalidate / juggler / junit / jw-uglify / karma / karma-0.9.1 / kissy-template / kiwi / kmc / knox / koko / ksp / lenient / less / less-config / less-imports / lessless / lexicon / license / line-remover / lineending / link / link-html / lint-bash / lint-inline / lintblame / linter / livereload / livescript / lmd / localtunnel / lodashbuilder / macreload / manifest / mapcat / markdown / markdown-blog / markdown-to-json / markx / maven-tasks / md2html / md5 / md5-manifest / mdlldr / messageformat / mincer / mindirect / minified / minifykr / minispade / minjson / mins / mixin-dir / mkdir / mocha-cli / mocha-cov / mocha-hack / mocha-phantomjs / mocha-test / mod-dev / modernizr / modules / mustache / native2ascii / natural-docs / ne / net / neuter / newrelic / ng-constant / node-qunit / nodemon / nodequnit / nodestatic / notify / o-bundle-commands / open / oversprite / ozjs / ozjs-tudou / package-environment / pakmanager / parallel / parseunicode / pathfinder / peaches / peg / peon-gui / pg / phonegap-build / php / php-analyzer / php-set-constant / phpcs / phpdocumentor / phplint / phpunit / pistachio-compiler / pkg-to-component / plato / play / plugin-angular-template-inline / plugin-buster / plugin-pkg2cmp / plugin-size / pngmin / preload / preloader-manifest-generator / preprocess / prettify / process-css / proxy / qettlhup / qpoc-closure-compiler / queen / qunit-cov / qunit-istanbul / qunit-junit / qunit-serverless / qunit-sonar / qunit-tap / r3m / rackspace / rcukes / recess / recursive-compass / reduce / regex-replace / release / release-branch / reload / reloadr / rem-to-px / remotefile / remove-logging / rename / rendr-stitch / replace / replace-dojo-cache / replace-main / require-dir / required / requiregrep / requirejs / requirejs-jzaefferer / requirejs-tasks / rerun / resx2json / retro / rev / rev-md5 / rev-package / rework / rigger / ristretto / rm / robot / roy / rsync / rsync-2 / ruby-haml / s3 / s3deploy / samsung-widgetlist / sass / sass-charset-del / sass-convert / saucelabs / saucelabs-qunit / say / scandium / scp / scriptlinker / sea-hashmap / sed / selenium / sencha-dependencies / sencha-jasmine / sf / sftp-deploy / shell / shell-completion / shell-spawn / shopify / shower-markdown / siml / simple-mocha / simple-smtp / simple-watch / sitemap / sizediff / sizereport / slim / sm-watch / smush-components / smushit / snapshot / snockets / soy / soy-compile / sp2010 / spark / spell / spm-build / spritesheet / spritesmith / ss-helpers / ssh / stats / steal / stitch / stitch-extra / string-replace / strip / style-temtem / styleguide / styletto / stylusguide / svgmin / svn-fetch / svn-update / svninfo / sweet / swig / symbolic-link / symfony2-console / symlink / symlinks / sync / tagrelease / tailor / targethtml / template-client / template-client-dot / template-helper / template-html / template-inline / template-jasmine-curljs / template-module / templater / templates / templatizer / testacular / testem / text-replace / three-obj / thrill / tishadow / tmplmin / todos / topcoat / tpl / tpsmate / traceur / translate / travis / tree / tsag / tusk / tusk-coffee / type / typescript / unicon / unicon-sass / urequire / usemin / usemin-baked / usemin-codio / useref / utils / variations / velocity.js / ver / verbosity / verifylowercase / version / vlt / volo / vows / vows-runner / vows-test / watch-nospawn / webdriver / webfont / webfontjson / webmake / webpack / wickit / willitmerge / winston / wintersmith / wisdom / wkhtmltopdf / wording / wrap / wrapper / wrapup / wx-copydir / wx-zipdir / wxi-shell / xmlmin / yaml / yate / yomb / yui-compressor / yuidocs / yukkuroid / zendesk-apps-tools / zip / zipstream / zobei-template / zoopinator / zopfli / gruntacular / gruntbuild / grunts / homemade / istanbul-mocha / js2uri / jwalsh-contrib-copy / lufax / mantri / masonjs / mongrel / node-asset-pipeline / nodetiles / projmate-consolidate / pw-rsync / pw-smushit / rcl / rosetta / smush-components / styles / svgo-grunt / tailored-jade / testdata-generator / testee / text2datauri / toast / towelie / webassemble / winningjs-build / winningjs-svg2png

13年5月6日月曜日

Page 7: My best grunt

Gruntcontrib / contrib-clean / contrib-coffee / contrib-compass / contrib-compress / contrib-concat / contrib-connect / contrib-copy / contrib-csslint / contrib-cssmin / contrib-handlebars / contrib-htmlmin / contrib-imagemin / contrib-jade / contrib-jasmine / contrib-jshint / contrib-jst / contrib-less / contrib-livereload / contrib-mincss / contrib-nodeunit / contrib-qunit / contrib-requirejs / contrib-sass / contrib-stylus / contrib-uglify / contrib-watch / contrib-yuidoc / amd-doc / assemble / assemble-less / assemble-package-manager / assemble-utils / assetflow / atpackager / bbb / build-bootstrap / can-compile / coffee2closure / config-heroku / connect-modrewrite / dp-contrib-copy / enyo / fe / aggregator / akamai-clear / amd-check / amd-checkrequire / amd-dist / amd-doc / amd-test / anglebars / angular-annotator / angular-seed / angular-templates / angular-templates-amd / angular-verifybuild / annotated-requirejs / ant-sfdc / apidoc / append-sourcemapping / append-templates / asciify / asset-mapper / asset-revisions / assetify / assetpush / assets-revving / assets-versioning / at-class / autoprefixer / aws / backbone-routes / backbonebuilder / bake / banner / barista / barkeep / batman-template / bbb-requirejs / bbb-server / bbb-styles / beautify / behat / bem / benchmark / bg-shell / blanket / bless / blink1 / blueprints / bom / bookmarklet-thingy / bootstrap / booty / bower / bower-concat / bower-config / bower-hooks / bower-install / bower-organiser / bower-requirejs / bower-task / bowerful / browserify / browserify2 / browserstack / build-docs / build-gh-pages / build-requirejs / buildconcat / buildfiles / bump / bumpup / bumpx / buster / buster-plugin / bvitk-tools / cachebuster / cafe-mocha / casper / casperjs / cat / cdn / cdn-refresh / changelog / check-modules / check-online / chmod / chrome-manifest / clean / cleanx / clear / client-compiler / clientside / closure-compiler / closure-linter / closure-soy / closure-tools / closure-wrap / closurecompiler / cloudfiles / cloudfront-clear / cmd-combo / cmd-concat / cmd-transport / cms-site-scaffold / cms-upload / coffee / coffee-coverage / coffee-percolator / coffee-redux / coffee-server / coffeecup / coffeeify / coffeelint / combine / comment-media-queries / commonjs / commonjs-handlebars / compile-handlebars / complexity / compliment / component / component-build / concat / concat-sourcemap / concurrent / config / connect / connect-proxy / connect-rewrite / consolidate-css / context / contrib / contrib-clean / contrib-coffee / contrib-compass / contrib-compress / contrib-concat / contrib-connect / contrib-copy / contrib-csslint / contrib-cssmin / contrib-handlebars / contrib-htmlmin / contrib-imagemin / contrib-jade / contrib-jasmine / contrib-jshint / contrib-jst / contrib-less / contrib-livereload / contrib-mincss / contrib-nodeunit / contrib-qunit / contrib-requirejs / contrib-sass / contrib-stylus / contrib-uglify / contrib-watch / contrib-yuidoc / couch / couchapp / coverjs / cp / crane / crusher / crx / css / css-amd / css-collect / css-combo / css2js / cssc / csscss / cssjoin / csso / cssrb / cucumber / curl / customize-bootstrap / data-uri / dawg / dep-concat / dependencygraph / dependo / devcode / develop / devserver / devtools / dir2json / docco / docker / docs / docsitebuilder / docular / dojo / dom-munger / dot / dot-compiler / dot-precompile / dotjs / dotlit / download / dox / drush / dss / dust / dust-html / dustjs / eco / eco-amd / ect / ect-templates / eiffel / email-builder / ember-handlebars / ember-templates / emberify / emblem / encase / ender / env / es6-module-transpiler / esmangle / este / exec / exists / express / express-bootstrap / express-server / extdeps / extendscript / fail / fenbi-tasks / fest / file-creator / file-regex-rename / filesize / fileslist / fingerprint / flyway / forever / frontend / fscss / ftp-deploy / functional / furnace / fuse / gcc / ghost / gint / git / git-authors / git-contributors / git-describe / gitco / github-pages / gjslint / global-config / glue / groc / groundskeeper / growl / grunticon / grunticon-highrespng / grunticon-sass / grunticon-stylus / gss-pull / haml / handlebars-compiler / handlebars-custom / handlebars-js / handlebars-requirejs / handlebars-seajs / handlebars-static / hapi / hash / hashmap / hashres / haxe / heroku-deploy / hogan / hogan-client / hoganjs / html / html-annotation / html-build / html-builder / html-json-wrapper / html-prettyprinter / html-smoosher / html-snapshot / html-validation / html2js / html2json / htmlbuild / htmlcompressor / htmlgen / htmlhint / htmlrefs / httpcopy / hub / hug / hull-widgets / hustler / iced-coffee / iconv / ie9-selector-counter / image-embed / image-normalize / imagemagick / images / imagine / imgmin / imgo / importsrc / include / include-bootstrap / include-replace / include-replace-cwd / includes / indent / init-browser / init-gruntplugin2 / init-init / init-mootools / init-plugin / inline-assets / inline-css / install-dependencies / install-init / invalidate-cloudfront / iron-worker / istanbul / it / itv / jade / jade-handlebars / jade-plugin / jaded / jam / jasmine / jasmine-coverage / jasmine-html-runner / jasmine-html-spec-runner / jasmine-node / jasmine-node-lite / jasmine-node-task / jasmine-runner / jasmine-spec-server / jasmine-task / jassi / java-properties / jekyll / jenkins / jetrunner / jquery-content / jquery-json / jquerybuilder / jquerytransform / jsbeautifier / jsdoc / jsdoc-plugin / jsduck / jshint2 / jsio / jslint / jsmin-sourcemap / json / json-minify / json-schema / jsonlint / jsonmin / jssemicoloned / jstemplater / jstestdriver / jstools / jsttojs / jsvalidate / juggler / junit / jw-uglify / karma / karma-0.9.1 / kissy-template / kiwi / kmc / knox / koko / ksp / lenient / less / less-config / less-imports / lessless / lexicon / license / line-remover / lineending / link / link-html / lint-bash / lint-inline / lintblame / linter / livereload / livescript / lmd / localtunnel / lodashbuilder / macreload / manifest / mapcat / markdown / markdown-blog / markdown-to-json / markx / maven-tasks / md2html / md5 / md5-manifest / mdlldr / messageformat / mincer / mindirect / minified / minifykr / minispade / minjson / mins / mixin-dir / mkdir / mocha-cli / mocha-cov / mocha-hack / mocha-phantomjs / mocha-test / mod-dev / modernizr / modules / mustache / native2ascii / natural-docs / ne / net / neuter / newrelic / ng-constant / node-qunit / nodemon / nodequnit / nodestatic / notify / o-bundle-commands / open / oversprite / ozjs / ozjs-tudou / package-environment / pakmanager / parallel / parseunicode / pathfinder / peaches / peg / peon-gui / pg / phonegap-build / php / php-analyzer / php-set-constant / phpcs / phpdocumentor / phplint / phpunit / pistachio-compiler / pkg-to-component / plato / play / plugin-angular-template-inline / plugin-buster / plugin-pkg2cmp / plugin-size / pngmin / preload / preloader-manifest-generator / preprocess / prettify / process-css / proxy / qettlhup / qpoc-closure-compiler / queen / qunit-cov / qunit-istanbul / qunit-junit / qunit-serverless / qunit-sonar / qunit-tap / r3m / rackspace / rcukes / recess / recursive-compass / reduce / regex-replace / release / release-branch / reload / reloadr / rem-to-px / remotefile / remove-logging / rename / rendr-stitch / replace / replace-dojo-cache / replace-main / require-dir / required / requiregrep / requirejs / requirejs-jzaefferer / requirejs-tasks / rerun / resx2json / retro / rev / rev-md5 / rev-package / rework / rigger / ristretto / rm / robot / roy / rsync / rsync-2 / ruby-haml / s3 / s3deploy / samsung-widgetlist / sass / sass-charset-del / sass-convert / saucelabs / saucelabs-qunit / say / scandium / scp / scriptlinker / sea-hashmap / sed / selenium / sencha-dependencies / sencha-jasmine / sf / sftp-deploy / shell / shell-completion / shell-spawn / shopify / shower-markdown / siml / simple-mocha / simple-smtp / simple-watch / sitemap / sizediff / sizereport / slim / sm-watch / smush-components / smushit / snapshot / snockets / soy / soy-compile / sp2010 / spark / spell / spm-build / spritesheet / spritesmith / ss-helpers / ssh / stats / steal / stitch / stitch-extra / string-replace / strip / style-temtem / styleguide / styletto / stylusguide / svgmin / svn-fetch / svn-update / svninfo / sweet / swig / symbolic-link / symfony2-console / symlink / symlinks / sync / tagrelease / tailor / targethtml / template-client / template-client-dot / template-helper / template-html / template-inline / template-jasmine-curljs / template-module / templater / templates / templatizer / testacular / testem / text-replace / three-obj / thrill / tishadow / tmplmin / todos / topcoat / tpl / tpsmate / traceur / translate / travis / tree / tsag / tusk / tusk-coffee / type / typescript / unicon / unicon-sass / urequire / usemin / usemin-baked / usemin-codio / useref / utils / variations / velocity.js / ver / verbosity / verifylowercase / version / vlt / volo / vows / vows-runner / vows-test / watch-nospawn / webdriver / webfont / webfontjson / webmake / webpack / wickit / willitmerge / winston / wintersmith / wisdom / wkhtmltopdf / wording / wrap / wrapper / wrapup / wx-copydir / wx-zipdir / wxi-shell / xmlmin / yaml / yate / yomb / yui-compressor / yuidocs / yukkuroid / zendesk-apps-tools / zip / zipstream / zobei-template / zoopinator / zopfli / gruntacular / gruntbuild / grunts / homemade / istanbul-mocha / js2uri / jwalsh-contrib-copy / lufax / mantri / masonjs / mongrel / node-asset-pipeline / nodetiles / projmate-consolidate / pw-rsync / pw-smushit / rcl / rosetta / smush-components / styles / svgo-grunt / tailored-jade / testdata-generator / testee / text2datauri / toast / towelie / webassemble / winningjs-build / winningjs-svg2png

763plugins

2013/05/05

13年5月6日月曜日

Page 8: My best grunt

type `npm !npm install grunt-cli -g mkdir “your project” && cd “your project”npm install grunt --save-devnpm install grunt-contrib --save-devnpm install grunt-simple-mocha --save-dev

13年5月6日月曜日

Page 9: My best grunt

create `Gruntfile.coffee !vi Gruntfile.coffee

Gruntfile is

BluePrint for Tasks

13年5月6日月曜日

Page 10: My best grunt

module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON 'package.json' coffee: compile: options: bare: true files: 'public/js/myproject.js': 'src/client/myproject.coffee'

simplemocha: all: src: 'test/**/*_test.coffee' options: ui: 'bdd' reporter: 'spec'

docco: index: src: [‘src/index.coffee'] options: output: 'docs/' watch: scripts: files: '**/*.coffee' tasks: ['simplemocha', 'coffee'] options: interrupt: true grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-clean' grunt.loadNpmTasks 'grunt-docco' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-simple-mocha' # Default task. grunt.registerTask 'default', ['simplemocha', 'coffee']

13年5月6日月曜日

Page 11: My best grunt

module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON 'package.json' coffee: compile: options: bare: true files: 'public/js/myproject.js': 'src/client/myproject.coffee'

simplemocha: all: src: 'test/**/*_test.coffee' options: ui: 'bdd' reporter: 'spec'

docco: index: src: [‘src/index.coffee'] options: output: 'docs/' watch: scripts: files: '**/*.coffee' tasks: ['simplemocha', 'coffee'] options: interrupt: true grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-clean' grunt.loadNpmTasks 'grunt-docco' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-simple-mocha' # Default task. grunt.registerTask 'default', ['simplemocha', 'coffee']

gruntコマンドが利用する

13年5月6日月曜日

Page 12: My best grunt

module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON 'package.json' coffee: compile: options: bare: true files: 'public/js/myproject.js': 'src/client/myproject.coffee'

simplemocha: all: src: 'test/**/*_test.coffee' options: ui: 'bdd' reporter: 'spec'

docco: index: src: [‘src/index.coffee'] options: output: 'docs/' watch: scripts: files: '**/*.coffee' tasks: ['simplemocha', 'coffee'] options: interrupt: true grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-clean' grunt.loadNpmTasks 'grunt-docco' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-simple-mocha' # Default task. grunt.registerTask 'default', ['simplemocha', 'coffee']

タスク群の設定

13年5月6日月曜日

Page 13: My best grunt

module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON 'package.json' coffee: compile: options: bare: true files: 'public/js/myproject.js': 'src/client/myproject.coffee'

simplemocha: all: src: 'test/**/*_test.coffee' options: ui: 'bdd' reporter: 'spec'

docco: index: src: [‘src/index.coffee'] options: output: 'docs/' watch: scripts: files: '**/*.coffee' tasks: ['simplemocha', 'coffee'] options: interrupt: true grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-clean' grunt.loadNpmTasks 'grunt-docco' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-simple-mocha' # Default task. grunt.registerTask 'default', ['simplemocha', 'coffee']

package.jsonを読み込むこの内容は”<% %>”のtemplateの中でpkg.XXXとして利用可能

13年5月6日月曜日

Page 14: My best grunt

module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON 'package.json' coffee: compile: options: bare: true files: 'public/js/myproject.js': 'src/client/myproject.coffee'

simplemocha: all: src: 'test/**/*_test.coffee' options: ui: 'bdd' reporter: 'spec'

docco: index: src: [‘src/index.coffee'] options: output: 'docs/' watch: scripts: files: '**/*.coffee' tasks: ['simplemocha', 'coffee'] options: interrupt: true grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-clean' grunt.loadNpmTasks 'grunt-docco' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-simple-mocha' # Default task. grunt.registerTask 'default', ['simplemocha', 'coffee']

coffee (grunt-contrib-coffee)の設定compileというサブタスクの処理が記述されている

13年5月6日月曜日

Page 15: My best grunt

module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON 'package.json' coffee: compile: options: bare: true files: 'public/js/myproject.js': 'src/client/myproject.coffee'

simplemocha: all: src: 'test/**/*_test.coffee' options: ui: 'bdd' reporter: 'spec'

docco: index: src: [‘src/index.coffee'] options: output: 'docs/' watch: scripts: files: '**/*.coffee' tasks: ['simplemocha', 'coffee'] options: interrupt: true grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-clean' grunt.loadNpmTasks 'grunt-docco' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-simple-mocha' # Default task. grunt.registerTask 'default', ['simplemocha', 'coffee']

simplemocha (grunt-simple-mocha)の設定allというサブタスクの処理が記述されている

13年5月6日月曜日

Page 16: My best grunt

module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON 'package.json' coffee: compile: options: bare: true files: 'public/js/myproject.js': 'src/client/myproject.coffee'

simplemocha: all: src: 'test/**/*_test.coffee' options: ui: 'bdd' reporter: 'spec'

docco: index: src: [‘src/index.coffee'] options: output: 'docs/' watch: scripts: files: '**/*.coffee' tasks: ['simplemocha', 'coffee'] options: interrupt: true grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-clean' grunt.loadNpmTasks 'grunt-docco' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-simple-mocha' # Default task. grunt.registerTask 'default', ['simplemocha', 'coffee']

上記のtaskの処理実装が書かれているnpmをloadしている

13年5月6日月曜日

Page 17: My best grunt

module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON 'package.json' coffee: compile: options: bare: true files: 'public/js/myproject.js': 'src/client/myproject.coffee'

simplemocha: all: src: 'test/**/*_test.coffee' options: ui: 'bdd' reporter: 'spec'

docco: index: src: [‘src/index.coffee'] options: output: 'docs/' watch: scripts: files: '**/*.coffee' tasks: ['simplemocha', 'coffee'] options: interrupt: true grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpmTasks 'grunt-contrib-clean' grunt.loadNpmTasks 'grunt-docco' grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-simple-mocha' # Default task. grunt.registerTask 'default', ['simplemocha', 'coffee']

taskのaliasを行い、自分好みの順序で実行したいTask群を設定する

13年5月6日月曜日

Page 18: My best grunt

type `grunt !% grunt coffeeRunning "coffee:compile" (coffee) taskFile public/js/myproject.js' created.

Done, without errors.

% grunt watchRunning "watch" taskWaiting...

13年5月6日月曜日

Page 19: My best grunt

オレの最強のGruntfile

13年5月6日月曜日

Page 20: My best grunt

coffee-coverage :simple-mocha : contrib-coffee :contrib-uglify :

contrib-compress :docco :

contrib-watch :

check code coveragemake testcompile coffee-scriptuglify codemake zipand create documentobserve all tasks

13年5月6日月曜日

Page 21: My best grunt

code coverageを求めtestを走らせcoffeeをbuildし圧縮しzip化しdocumentを作成しファイルを監視し変更があれば自動で実行!

13年5月6日月曜日

Page 22: My best grunt

※注意1: doccoは開発者多忙につきdocco本体のバージョンアップに追従できていませんhttps://github.com/DavidSouther/grunt-docco/pull/14

13年5月6日月曜日

Page 23: My best grunt

※注意2:coffee-coverageによるカバレッジテストの際には読み込むファイルを変更する(lib-covなど)必要あり

test/*_test.coffeeで環境変数によって分岐させる必要あり

grunt-execで、コマンド叩く必要あり

13年5月6日月曜日

Page 24: My best grunt

※注意2:coffee-coverageによるカバレッジテストの際には読み込むファイルを変更する(lib-covなど)必要あり

test/*_test.coffeeで環境変数によって分岐させる必要あり

grunt-execで、コマンド叩く必要あり

正直萎えるんで誰か頼む

13年5月6日月曜日

Page 25: My best grunt

Gruntかわいいよ

Grunt13年5月6日月曜日