task runner
play

Task Runner Winter Semester 2016/17 Juliane Franze - PowerPoint PPT Presentation

Prac%cal Course: Web Development Task Runner Winter Semester 2016/17 Juliane Franze Ludwig-Maximilians-Universitt Mnchen Prac=cal Course Web Development WS


  1. Prac%cal ¡Course: ¡Web ¡Development ¡ Task ¡Runner ¡ Winter ¡Semester ¡2016/17 ¡ Juliane ¡Franze ¡ Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 1 ¡

  2. Today’s ¡Agenda ¡ • Taks ¡Runner ¡: ¡Grunt ¡vs. ¡Gulp ¡ – Gulp ¡installa=on ¡ Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 2 ¡

  3. Grunt ¡& ¡Gulp ¡ • Both ¡are ¡Javascript ¡TaskRunner ¡ • Create ¡tasks ¡that ¡fit ¡specific ¡needs ¡ • Grunt ¡ – Writes ¡temporary ¡files ¡ – Config ¡each ¡plugin ¡seperately ¡ ¡ Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 3 ¡

  4. Gulp ¡ ¡ • Streaming ¡building ¡system ¡ ¡ • Pipe ¡and ¡pass ¡data ¡manipulated ¡or ¡used ¡by ¡plugins ¡ • Code ¡over ¡configura=on ¡ • Tasks ¡are ¡wriUen ¡in ¡code ¡ à ¡Feels ¡like ¡a ¡build ¡framework ¡ • ¡Uses ¡node.js ¡streams ¡ • No ¡need ¡for ¡temporary ¡files ¡ à ¡Everything ¡done ¡in ¡Memory ¡ Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 4 ¡

  5. Gulp ¡ ¡ • Plugins ¡ – Intended ¡to ¡do ¡only ¡one ¡job ¡each ¡ – Common ¡to ¡pass ¡a ¡file ¡through ¡mul=ple ¡plugins ¡ • 4 ¡top ¡level ¡func=ons ¡ – Gulp.task ¡ ¡defines ¡the ¡tasks ¡ – Gulp.src ¡ ¡which ¡files ¡to ¡use ¡ – Gulp.dest ¡ ¡output ¡folder ¡where ¡final ¡files ¡go ¡ – Gulp.watch ¡which ¡files ¡to ¡watch ¡ Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 5 ¡

  6. � � Gulp ¡taks ¡ • Defines ¡tasks ¡ Task ¡Name ¡ gulp. task ( 'mytask' , function (){ � Dep ¡Array ¡ //do stuff � }); � gulp.taks( 'dependenttask' , [ 'mytask' ], function (){ � //do stuff after 'mytask' is done. � }); � ¡ Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 6 ¡

  7. Install ¡Gulp ¡ 1. Install ¡Gulp ¡globally ¡ – npm ¡install ¡–g ¡gulp ¡ ¡ ¡ (maybe ¡„sudo“ ¡needed) ¡ 2. Install ¡Gulp ¡as ¡devDependencies ¡in ¡any ¡project ¡you ¡want ¡ – npm ¡install ¡-­‑-­‑save-­‑dev ¡gulp ¡ 3. Create ¡gulpfile.js ¡in ¡project ¡root ¡ ¡(manually) ¡ 4. Install ¡some ¡Plugins ¡ To ¡test ¡if ¡Gulp ¡is ¡working ¡ à ¡„gulp ¡u=ls“ ¡ – – npm ¡install ¡-­‑-­‑save-­‑dev ¡gulp-­‑util ¡ 5. Create ¡ ¡tasks ¡(see ¡right) ¡ 6. Run ¡it: ¡ ¡ gulp ¡ – Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 7 ¡

  8. Add ¡Further ¡Task ¡Op%ons ¡ HTML ¡ • – Minify ¡(gulp-­‑minify-­‑html) ¡ CSS ¡ • – Minify ¡(gulp-­‑cssnano ¡oder ¡gulp-­‑minify-­‑css) ¡ JS ¡ • – Check ¡JS ¡data ¡(gulp-­‑jshint) ¡ – Concat ¡JS ¡(gulp-­‑concat) ¡ – Minify ¡JS ¡(gulp-­‑uglify) ¡ Copy ¡Data ¡ • – In ¡new ¡Folder ¡for ¡upload ¡ No=fy ¡on ¡changes ¡ ¡ • – Check ¡Data(gulp-­‑no=fy ¡ Single ¡tasks ¡can ¡be ¡run ¡be ¡their ¡name ¡ • – „gulp ¡default“ ¡ CheatSheet ¡ • – hUps://raw.githubusercontent.com/osscafe/gulp-­‑cheatsheet/master/images/en-­‑js-­‑p1.png ¡ ¡ Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 8 ¡

  9. Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 9 ¡

  10. Use ¡Further ¡Plugins ¡ 1. Install ¡some ¡Plugins ¡with ¡one ¡command ¡ – npm ¡install ¡–-­‑save-­‑dev ¡gulp-­‑concat ¡ – ...gulp-­‑minify-­‑html ¡gulp-­‑jshint ¡gulp-­‑uglify ¡gulp-­‑ minify-­‑css ¡ 2. Add ¡plugin(s) ¡to ¡gulpfile.js ¡ 3. Create ¡ ¡tasks ¡(for ¡concat) ¡ 4. Create ¡Pipes ¡& ¡Watchers ¡ 5. Add ¡tasks ¡to ¡‚default‘ ¡task ¡ 6. Run: ¡ ¡ – gulp ¡ 7. Add ¡minify ¡& ¡clean-­‑css ¡ – npm ¡install ¡–save-­‑dev ¡gulp-­‑clean-­‑css ¡gulp-­‑minify ¡ 8. Add ¡plugin ¡to ¡pipe ¡ Ludwig-­‑Maximilians-­‑Universität ¡München ¡ Prac=cal ¡Course ¡Web ¡Development ¡WS ¡16/17 ¡-­‑ ¡01 ¡-­‑ ¡ ¡ 10 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend