Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
株式会社 Loco Partners の社内開発 LT 2014年11月18
Search
Kenya Yamaguchi
November 18, 2014
Technology
2
88
株式会社 Loco Partners の社内開発 LT 2014年11月18
2014年11月18日開催
株式会社 Loco Partners の社内開発 LT で Grunt の超入門について発表
Kenya Yamaguchi
November 18, 2014
Tweet
Share
More Decks by Kenya Yamaguchi
See All by Kenya Yamaguchi
はじめよう CakePHP3
ken880guchi
0
400
DevOps勉強会 LT_2014_11_26
ken880guchi
0
110
Hubot×ChatOps勉強会
ken880guchi
1
1.3k
Other Decks in Technology
See All in Technology
5分でわかるDuckDB
chanyou0311
10
3.2k
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
270
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
5
170
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
180
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
160
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
17
14k
Storage Browser for Amazon S3
miu_crescent
1
210
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
750
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
17
4.6k
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Visualization
eitanlees
146
15k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
How GitHub (no longer) Works
holman
311
140k
A designer walks into a library…
pauljervisheath
204
24k
Optimising Largest Contentful Paint
csswizardry
33
3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Designing Experiences People Love
moore
138
23k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Transcript
GRUNT നଳ
None
࠷ۙͷ WEB ΞϓϦ
࠷ۙͷ WEB ΞϓϦ։ൃ AltJS (CoffeeScript, TypeScript) ͷίϯύΠϧ ֦ு CSS (Sass,
Less, Stylus) ͷίϯύΠϧ JS, CSS ͷ݁߹ͱѹॖ JS, CSS ͷߏจνΣοΫ
(खಈͰ)ͬͯΒΕΔ͔ʁ
͜Μͳͷ͋Γ·͢ɻ
GRUNT ʁ
Node.jsΛ༻ͨ͠ ࣗಈϏϧυπʔϧ
ʁʁʁ
࠷ۙͷ WEB ΞϓϦ։ൃ AltJS (CoffeeScript, TypeScript) ͷίϯύΠϧ ֦ு CSS (Sass,
Less, Stylus) ͷίϯύΠϧ JS, CSS ͷ݁߹ͱѹॖ JS, CSS ͷߏจνΣοΫ ཁ͢Δʹɺ͜ΕΒΛશ෦ GRUNT ͕ࣗಈͰͬͯ͘ΕΔʂ
ͰɺࢲͦΜͳͷ֮͑ͯΔ ࣌ؒͳ͍͠ɻɻɻ ͦΜͳͷΘͳͯ͘ؾ߹͍Ͱख࡞ ۀͰΔ͠ɻɻɻ
None
GRUNT ͜Μͳʹ؆୯ʹ࢝ΊΕΔʂ (ಥʹ࢝·Δ४උखॱ) ࠇ͍ը໘(ίϯιʔϧ)Λ։͍ͯɺ্͔Βॱʹίϐʔ & షΓ ͚ ͔Βͷ Enter!!! cd
~ && mkdir sandbox && mkdir -p sandbox/assets/css && mkdir sandbox/css touch sandbox/assets/css/part1.css && echo "body { background-color: #F2F2F0; }" > sandbox/assets/css/part1.css touch sandbox/assets/css/part2.css && echo "h1 { font-size: 100%; }" > sandbox/assets/css/part2.css
GRUNT ͜Μͳʹ؆୯ʹ࢝ΊΕΔʂ (ಥʹ࢝·Δ४උखॱ) ࠇ͍ը໘(ίϯιʔϧ)Λ։͍ͯɺ্͔Βॱʹίϐʔ & షΓ ͚ ͔Βͷ Enter!!! cd
~ && mkdir sandbox && mkdir -p sandbox/assets/css && mkdir sandbox/css touch sandbox/assets/css/part1.css && echo "body { background-color: #F2F2F0; }" > sandbox/assets/css/part1.css touch sandbox/assets/css/part1.css && echo "h1 { font-size: 100%; }" > sandbox/assets/css/part2.css
GRUNT ͜Μͳʹ؆୯ʹ࢝ΊΕΔ (ಥʹ࢝·ΔΠϯετʔϧखॱ) cd ~/sandbox ruby -e "$(curl -fsSL https://raw.githubusercontent.com/
Homebrew/install/master/install)" brew npm install npm install -g grunt-cli npm install grunt-contrib จࣈ͕Ұഋग़ͯ͘Δ͚ͲɺΠϯ ετʔϥʔͰιϑτΛΠϯετʔϧ ͍ͯ͠ΔΑ͏ͳͷͰ͢ɻ
GRUNT ͜Μͳʹ؆୯ʹ࢝ΊΕΔ (ಥʹ࢝·ΔΠϯετʔϧखॱ) cd ~/sandbox ruby -e "$(curl -fsSL https://raw.githubusercontent.com/
Homebrew/install/master/install)" brew npm install npm install -g grunt-cli npm install grunt-contrib จࣈ͕Ұഋग़ͯ͘Δ͚ͲɺΠϯ ετʔϥʔͰιϑτΛΠϯετʔϧ ͍ͯ͠ΔΑ͏ͳͷͰ͢ɻ
GRUNT ͜Μͳʹ؆୯ʹ࢝ΊΕΔ (࠷ޙͷΠϯετʔϧखॱ) cd ~/sandbox npm init ରܗࣜͰ৭ʑϝοηʔδ͕ग़ͯ͘Δ ͷͰɺͻͨ͢ΒEnterΛ࿈ଧʂʂ
͏ɺΠϯετʔϧऴΘΓɻ
Ͱʁ
ͳʹ͢Μͷʁ
ɹCSS ͷ݁߹Λ GRUNT ʹ खͬͯΒ͍·͠ΐ͏
GRUNT ઃఆखॱ (CSS ͷ݁߹) cd ~/sandbox vi Gruntfile.js module.exports =
function(grunt) { grunt.initConfig({ cssmin: { compress: { files: { 'css/kansei.css': [ 'assets/css/part1.css', 'assets/css/part2.css' ] } } } }); grunt.loadNpmTasks('grunt-contrib-cssmin'); }; ϑΝΠϧͷதʹ ͍ͭ͜Λॻ͖ࠐΜͰอଘ ! ͖ͳΤσΟλͰ ࡞ͯ͠େৎʂ
GRUNT ࣮ߦʂ ! > grunt cssmin
GRUNT ࣮ߦʂ ! > grunt cssmin Running "cssmin:compress" (cssmin) task
File css/kansei.css created: 60 B → 48 B ! Done, without errors. ͳΜ͔Ͱͨʂʂ
͏ɺCSS ݁߹࡞ۀऴΘͬͯ·͢ɻ
GRUNT ͕ੜͨ͠ϑΝΠϧΛ֬ೝ cd ~/sandbox cat css/kansei.css
GRUNT ·ͱΊ ͜ͷଞʹ Grunt ʹศརͳػೳɺ֦ு͕ࢁ͋Γ ·͢ɻ৭ʑௐͯ Gruntfile.js ΛࣗΈʹΧελϚ Πζ͠·͠ΐ͏ɻ ࠇ͍ը໘(ίϯιʔϧ)͕ා͍ͳΒΤϯδχΞʹڠྗ
ͯ͠Β͍·͠ΐ͏ɻ ҰਓͰΔͳΒɺ͡Ίਂ͘ߟ͑ͣʹͱΓ͋͑ ࣮ͣߦͯ͠Έ·͠ΐ͏ɻ
ຊ͕Μ͍͖ͬͯ·͠ΐ͏ʂ