Gulp
10å¹´ãããåã«ä½ã£ã WEB ãµã¤ãã®æ¹ä¿®æ¡ä»¶ãçºçãã¦ãæ§æãå¤ããã¦æã«è² ããªããªã£ã¦ããã®ã§ã³ã¬ãæ°ã«ãã«ãç°å¢ãè¦ç´ãã¾ããã å ã®ãã®ã Grunt 㧠JS ãçµåããã SCSS ããã«ããã¦ããæ§æã ã£ãã®ã§ Grunt ã Gulp ã«ç½®ãæããSCSS ã®ãã«â¦
ãªãã¼ããããé¢æ°ãããã®ã§ãgulpã§watchãã¦ããæãªã©å¥½ããªã¿ã¤ãã³ã°ã§localhostããªãã¼ãããããã¨ãã§ããgulp-connectã§ããããªãã¼ããããã¿ã¹ã¯ãã¾ã¨ãããã¨ããæã«ãã§ãããããããã©ãããåã£ãã®ã§ã¡ã¢ã å ¬å¼ã«æ¸ããã¦ãããæ¹ ââ¦
gulpã§ãµã¤ãä½ãæã®ãã¼ã«ã«ãµã¼ãã¼ã«é·ããgulp-webserverã使ã£ã¦ããã®ã§ãããCSSã®å¤æ´æã«hotreloadãä¸æãåä½ããããªãã¼ããããé¢æ°ãç¡ãã£ã½ãã£ãã®ã§ãreloadé¢æ°ãæãä»»æã®ã¿ã¤ãã³ã°ã§ãªãã¼ãããããã¨ãã§ããgulp-connectã«ä¹ãâ¦
gulp4 watchçµäºããã The following tasks did not complete ã£ã¦ã¨ã©ã¼ã表示ããã件
æä½ã£ãgulpã§pugã¨stylusã³ã³ãã¤ã«ãã¦ãã ãã®LPãæ´æ°ã§å¼ã£ã¦ãã¾ããã gulpã§watchãã¦ãããã»ã¹ãçµäºããã [23:55:48] The following tasks did not complete: default, watchHTML, watchCSS [23:55:48] Did you forget to signal async completâ¦
gulp v4 ã§è¿½å ãããgulp.seriesã¨gulp.parallelã試ãã¦ã¿ã gulp.series(...tasks) ... é çªã«å®è¡ãã gulp.parallel(...tasks) ... 並åã«å®è¡ããã GitHubã®ãµã³ãã« gulp.task('one', function(done) { // do stuff done(); }); gulp.task('two', fuâ¦
Gulp v4ã«ãªã£ã¦v3ã®æ¸ãæ¹ã ã¨ã¨ã©ã¼ã«ãªãã±ã¼ã¹ããã£ãã®ã§ç§»è¡ããã¨ãã®ã¡ã¢ gulp.series 㨠gulp.parallel gulp v4ã§è¿½å ãããã¡ã½ãã added gulp.series and gulp.parallel methods for composing tasks. Everything must use these now. gulp.serâ¦
ãããéãã¦ä¸ä½ã©ãã«éè¦ãããã®ãè¬ãããã®ã§ãããgulpã§ãã£ã¬ã¯ããªæ§é ãä¿ã£ãã¾ã¾ãªãã¼ã ãã¦åºåããæ¹æ³ã試ãã¦ããã®ã§ã¡ã¢ã§ãã stylusã§è©¦ãã¦ã¾ããpugãsassãjsãã¡ã¤ã«ã§ãåããã¨æãã¾ãã renameããªãå ´åããã¹ã®/**/ã®é¨åã®â¦
nibã ãã ã¨ä»ã¯ä¸è¦ã«ãªã£ã¦ããã³ãã¼ãã¬ãã£ãã¯ã¹ãåºåãã¦ãã¾ãã®ã§autoprefixerã使ã£ã¦å¯¾è±¡ãã©ã¦ã¶ãã³ã³ããã¼ã«ããã¡ã¢ node: v9.6.1 npm: v6.1.0 [email protected] [email protected] [email protected] [email protected] install $ npm install --sâ¦
ä¹ ã ã«npm installãã¦gulpãåãããã¨ããã¨ãã $ gulp [08:46:54] Using gulpfile ~/Documents/local/gulpfile.js /.nodebrew/node/v6.9.2/lib/node_modules/gulp/bin/gulp.js:129 gulpInst.start.apply(gulpInst, toRun); ^ TypeError: Cannot read proâ¦
ååminimistã使ã£ã¦ã³ãã³ãããå®è¡ããjsã«å¤æ°ã渡ããããã«ãã¾ããã ä»åã¯ãå®éã«ã³ãã³ãã®ãªãã·ã§ã³ã§ä¾¿å©ã«gulpã使ããããã«ãã¦ã¿ãå®ä¾ã®ã¡ã¢ã§ãã ä¸ã¤ã®gulpä¸ã«è¤æ°ã®htmlãµã¤ãããã£ã¬ã¯ããªãåºåã£ã¦ç½®ãã¦ããã¤ã¡ã¼ã¸ã§ã次ã®â¦
以å Gulpã§ã¿ã¹ã¯ãæå®ãã¦å®è¡ãããã¨ã§ç¡çããå¦çãåå²ãããæ¹æ³ãæ¸ãã¦ãã¾ããã ä»ååããããªéè¦ãåã£ã¦èª¿ã¹ã¦ããã¨gulpå®è¡æã³ãã³ãã«ç´æ¥ãã¼ã¨å¼æ°ã渡ããç´ æ´ãããæ¹æ³ããã£ãã®ã§ã¡ã¢ã minimistã使ã£ã¦ã³ãã³ãã©ã¤ã³ããå¤æ°â¦
pugã¯HTMLãã³ãã¬ã¼ãã¨ã³ã¸ã³ãªã®ã§ãã gulp ãªã©ã§æ¡å¼µåããªãã¼ã ãã¦ãã¾ãã° PHPã®ãã³ãã¬ã¼ããã¡ã¤ã«ã«ããäºãã§ãã¾ãã ex: var gulp = require("gulp"), plumber = require("gulp-plumber"), rename = require('gulp-rename'), pug = requireâ¦
gulp-uglify v3.0.0 ãã/*!ã§å§ã¾ããããªã©ã¤ã»ã³ã¹ã®ã³ã¡ã³ããæ®ã preserveComments ãªãã·ã§ã³ã¯ä½¿ããªããªã£ã¦ããã®ã§ãã¨ã©ã¼ã«ãªãã 代ããã«output:{ comments: /^!/ }ã使ãã°OKã
ã³ã¼ãã£ã³ã°ãããæãGulpã§ã³ã³ãã¤ã«&minåããã¦ãã¾ãã minåããã³ã¼ãã«ã³ã¡ã³ãã§ãã¼ã¸ã§ã³æ å ±ã¨ããå ã®ã©ã¤ã»ã³ã¹æ å ±ãå ¥ãããã±ã¼ã¹ã¨ããããã¾ãã javascript ã©ã¤ãã©ãªãªã©ã®ã©ã¤ã»ã³ã¹æ å ±ã§/*!ã§å§ã¾ãã³ã¡ã³ãã®å ´åã¯gulp-uglifyâ¦
chaika.hatenablog.com node.jsã®ãã¼ã¸ã§ã³ãä¸ããããnode-sassã使ã£ã¦ããããã¸ã§ã¯ãã§gulpã³ãã³ããæã¤ã¨ã§æ¬¡ã®ãããªã¨ã©ã¼ãåºãããã«ãªãã¾ããã $ gulp [16:39:36] Warning: gulp version mismatch: [16:39:36] Global gulp is 3.9.1 [16:39â¦
$ gulp ã³ãã³ããæã¦ã°ãwebserverãèµ·åãã¦ãgulp.watchãå§ã¾ãããã«ããæ¹æ³ã®ã¡ã¢ gulpã³ãã³ãã¯gulp.task('default')ã§å®ç¾©ãããã®ãå®è¡ãããã®ã§ var gulp = require("gulp"), webserver = require('gulp-webserver'); gulp.task('default', fâ¦
javascriptã®ãã¡ã¤ã«ãJSHintã§ãã§ãã¯ãããã©ã対象ãã£ã¬ã¯ããªå ã®libãã£ã¬ã¯ããªå ã®ã©ã¤ãã©ãªãã¡ã¤ã«ã¯JSHintã®å¯¾è±¡ããå¤ãããã¨ããGulp.src()ã®å¯¾è±¡ããé¤å¤ããæ¹æ³ã®ã¡ã¢ã !æå®ããã°é¤å¤ã§ããã 対象ãã¡ã¤ã«ã®åã«!ã追å ããã°OK EX:â¦
Gulpã§javascriptã®ãã¡ã¤ã«ãç£è¦ JSHintã§ã¨ã©ã¼ãªã©ããã§ã㯠åé¡ããªããã°concatã§1ã¤ã«ã¾ã¨ãã¦ãminå browser-syncã§ãªãã¼ã ã¨ããå¦çãè¡ããããã¨æããGoogle Web Starter Kitãåèã«Gulpã®ã¿ã¹ã¯ãä½ã£ã¦ããã®ã§ãããä¸è¨ã®åé¡ã«å½ãâ¦
jadeã§ãã³ãã¬ã¼ããä½æãã¦ãã¦ãéçºæç¨ã¨æ¬çªç°å¢ç¨ã¨ã§CSSãjsã®èªã¿è¾¼ã¿ãå¤ãããã¨ãããããªäºãããã¾ãã jadeã§config.jadeã®æ§ãªãã®ãä½æãã¦ããã¦ãdevModeã®ãããªãã©ã°ãåºã«åºãåãããã¨ãåºæ¥ãã®ã§ãããé½åº¦å¤æ°ãå¤ãã¦ã³ã³ãâ¦
Gulpã§ã¿ã¹ã¯ãå®è¡ãã¦ãã¦ãåããããªå¦çã ãã©éçºç°å¢ã®æã¨æ¬çªãªãªã¼ã¹ç¨ã§ãªãã·ã§ã³ãå¤æ´ãããã¨ããããã¾ãã éçºç°å¢ç¨ã®ã¿ã¹ã¯ã¨ãæ¬çªç¨ã®ã¿ã¹ã¯ã¨ã§å¥ã«ã¿ã¹ã¯ãæ¸ãã°æ¸ã話ãªã®ã§ãããåããããªè¨è¿°ãå¢ãã¦ãã¾ãã®ãå°ããªãã ããªâ¦
æè¿ã¯gulpã§jadeãã³ã³ãã¤ã«ãã¦ãã¾ãã <ul> <li ng-class="{active: thing.score < 50}"> <a href='[permlink slug="url"]'>LINK</a> <li> <ul> HTMLã®å±æ§ãªã©ã®ä¸ã«WordPressã®ã·ã§ã¼ãã³ã¼ãããAngularJSã®ng-classã¨ããå±æ§ã®ä¸ã«ã³ã¼ãã¼ã·ã§ã³ã使ã£ãå¤ãå ¥ãããã±ã¼ã¹ãªã©ãããã¾ãã æ®éã«æ¸ãã¨ã¨ã¹ã±ã¼ãããã å±æ§ã®ä¸ã®<ã"ãã¨</ul></li></li></ul>â¦
æè¿Glupã«æ £ãããã¨é å¼µã£ã¦ãã¾ãã ä¸éä¸è¬ã§CSSã®ããªããã»ããµã¼ã¯ã¯SCSSãCompassããã¯ãå¤ãã®ã§ããããï¼ åã¯å人çã«Stylusã好ããªã®ã§ãä»æ¥ã¯ä»ã¾ã§Gruntã§ãã£ã¦ããstylus+nibã®ã³ã³ãã¤ã«ãGulpã§ãããã¨ãã¦ããã£ã¦ãã¾ã£ãã®ã¡ã¢ã§â¦
ããã±ã¼ã¸ããã¼ã¸ã£ã¼ã®Bowerã§Bootstrapãã¤ã³ã¹ãã¼ã«ãã¦ãGulpã使ã£ã¦Bootstrapã®CSSã¨javascriptãéçºãã£ã¬ã¯ããªã«æã£ã¦ããæ¹æ³ã®ã¡ã¢ã npmã使ãã®ã§node.jsãåãã£ã¦ã¤ã³ã¹ãã¼ã«ãã¦ããå¿ è¦ãããã¾ãã ããã¸ã§ã¯ãã®æºå $ npm init nâ¦
æè¿gruntããgulpã®æ¹ãç±ãï¼ã¨ããåãè´ãã¦ããªããªgruntæ´¾ã ã£ãã®ã§ãããã£ã¬ã³ã¸ãã¦ã¿ã¾ããã ã¤ã³ã¹ãã¼ã«ã¨ãã¯åãnodeé¢é£ãªã®ã§npm使ãã°ç°¡åã«ã§ããã®ã§ããã®è¾ºãgruntã¨å¤§å·®ãªãå°å ¥ã§ãããªããã£ã¦å°è±¡ã§ããã gruntã§è¨ãã¨ããã®waâ¦