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
最近流行り?の Middleman でモダンな Web 開発
Search
2no
September 21, 2013
1
1.2k
最近流行り?の Middleman でモダンな Web 開発
Middleman のインストール、プロジェクトの作成やローカル Web サーバを使った開発方法を簡単に説明します。
2no
September 21, 2013
Tweet
Share
More Decks by 2no
See All by 2no
FuelPHP 実践 Validation
2no
4
12k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
40
2.4k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Teambox: Starting and Learning
jrom
133
8.8k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Designing for Performance
lara
604
68k
Being A Developer After 40
akosma
86
590k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Transcript
࠷ۙྲྀߦΓʁͷ Middleman Ͱ Ϟμϯͳ Web ։ൃ 13/09/21 ୈ8ճ Creators MeetUp
139݄20༵ۚ
ࣗݾհ 139݄20༵ۚ
139݄20༵ۚ
• ೋٶ ಙ (χϊϛϠ ΧζϊϦ) 139݄20༵ۚ
• ೋٶ ಙ (χϊϛϠ ΧζϊϦ) • Twitter: @wakuworks 139݄20༵ۚ
• ೋٶ ಙ (χϊϛϠ ΧζϊϦ) • Twitter: @wakuworks • גࣜձࣾ
಼ 139݄20༵ۚ
• ೋٶ ಙ (χϊϛϠ ΧζϊϦ) • Twitter: @wakuworks • גࣜձࣾ
಼ • ීஈ PHP Λ͍ͬͯ͡·͢ɻ 139݄20༵ۚ
• ೋٶ ಙ (χϊϛϠ ΧζϊϦ) • Twitter: @wakuworks • גࣜձࣾ
಼ • ීஈ PHP Λ͍ͬͯ͡·͢ɻ ʢRuby ͬ͞ͺΓΘ͔Γ·ͤΜʣ 139݄20༵ۚ
1. Middleman ͱʁ 2. Πϯετʔϧ 3. ։ൃͷྲྀΕ 1. ϓϩδΣΫτͷ࡞ 2.
ϓϨϏϡʔαʔόͷىಈ 3. Ϗϧυ 4. ͓͞Β͍ 4. ͦͷଞ 5. ·ͱΊ ΞδΣϯμ 139݄20༵ۚ
1. Middleman ͱʁ 139݄20༵ۚ
1. Middleman ͱʁ Middleman Ϟμϯͳ web ։ൃڥͷͯ͢ͷ γϣʔτΧοτπʔϧΛ༻ͯ͠੩త web αΠ
τΛ࡞͢ΔͨΊͷίϚϯυϥΠϯπʔϧͰ͢ɻ Ҿ༻ɿhttp://middleman-guides.e2esound.com/getting-started/ l z ॴҦɺ੩తαΠτδΣωϨʔλͷҰͭͰ͢ɻ WEB ։ൃΛγϯϓϧͭߴʹͯ͘͠Ε·͢ɻ ࣅͨͰ Jekyll ͕༗໊Ͱ͢ɻ 139݄20༵ۚ
2. Πϯετʔϧ 139݄20༵ۚ
2. Πϯετʔϧ 139݄20༵ۚ
2. Πϯετʔϧ gem install middleman օ͞Μେ͖ʰࠇ͍ը໘ʱͰ ԼͷҰߦΛॻ͍ͯΤϯλʔԡ͚ͩ͢ʂ 139݄20༵ۚ
2. Πϯετʔϧ gem install middleman օ͞Μେ͖ʰࠇ͍ը໘ʱͰ ԼͷҰߦΛॻ͍ͯΤϯλʔԡ͚ͩ͢ʂ …جຊతʹɻ 139݄20༵ۚ
• Mac 2. Πϯετʔϧ gem install middleman Xcode Command Line
Tool ͕ඞཁͰ͢ɻ Xcode ܦ༝ͰΠϯετʔϧ͢Δ͔ɺσϕϩούϙʔλϧ͔Βύοέʔ δΛμϯϩʔυ͢Δඞཁ͕͋Γ·͢ɻ Xcode Command Line Tool ͷΠϯετʔϧ͕ྃͨ͠Βɺ ޙԼͷίϚϯυΛ࣮ߦͯ͠Πϯετʔϧ͠·͢ɻ 139݄20༵ۚ
2. Πϯετʔϧ • Ubuntu sudo apt-get ruby-dev nodejs g++ make
sudo gem install middleman nodejs ߹ΘͤͯೖΕ͓͔ͯͳ͍ͱɺ ޙड़͢ΔϓϨϏϡʔαʔόΛىಈ͢ΔࡍʹΤϥʔ͕ൃੜ͠·͢ɻ Ruby 1.8 ϢʔβͰ͋Εɺ߹Θͤͯ `ruby18_source_location` ͷΠϯετ ʔϧ͕ඞཁͰ͢ɻ sudo gem install ruby18_source_location 139݄20༵ۚ
2. Πϯετʔϧ • Windows ࠷ॳʹɺRuby, RubyGems ೖ͍ͬͯ·ͤΜɻ ͜ΕΒࣗͰΠϯετʔϧ͠ͳ͚ΕͳΓ·ͤΜɻ ▼Ruby, RubyGems
ͷΠϯετʔϥ http://rubyinstaller.org/downloads/ RubyInstallers ͷ߲ʹμϯϩʔ υϦϯΫ͕͋Γ·͢ɻ͖ͳόʔδ ϣϯͷΛམͱ͍ͯͩ͘͠͞ɻ ※ 1.8.7 Ҏ্Ͱ͋Εͳ͍ͱࢥ͍·͢ 139݄20༵ۚ
• Windows 2. Πϯετʔϧ ΠϯετʔϥΛىಈ͢ΔͱɺΟβʔυ͕։͖·͢ɻ༰ʹैͬͯਐΊͯ͘ ͍ͩ͞ɻ͜ΕͰ Ruby, RubyGems ͷΠϯετʔϧྃͰ͢ɻ ࣍ʹɺDEVELOPMENT
KIT ΠϯετʔϧͰ͢ɻ ઌ΄ͲͷμϯϩʔυϖʔδͷԼʹ DEVELOPMENT KIT ͷμϯϩʔυ ϦϯΫ͕͋Γ·͢ɻ 139݄20༵ۚ
• Windows 2. Πϯετʔϧ ӈਤͷͰғͬͨϑΝΠϧΛ μϯϩʔυ͍ͯͩ͘͠͞ɻ μϯϩʔυͨ͠ϑΝΠϧΛىಈ͢ΔͱɺͲ͜ʹల։͞ΕΔ͔ฉ͔Ε·͢ɻ దͳͱ͜ΖʹσΟϨΫτϦΛ࡞ͬͯల։͍ͯͩ͘͠͞ɻ 139݄20༵ۚ
2. Πϯετʔϧ • Windows ίϚϯυϓϩϯϓτɺ·ͨ PowerShell Λ։͖ɺઌ΄Ͳల։ͨ͠σΟϨΫ τϦʹҠಈͯ͠ɺԼͷίϚϯυΛ࣮ߦ͍ͯͩ͘͠͞ɻ ͕ͳ͚Εɺ͜ΕͰΠϯετʔϧྃͰ͢ɻ ruby
dk.rb init ruby dk.rb install gem update --system gem install wdm middleman 139݄20༵ۚ
3. ։ൃͷྲྀΕ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ middleman init [ϓϩδΣΫτ໊] ·ͨ·ͨօ͞Μେ͖ʰࠇ͍ը໘ʱͰ ԼͷҰߦΛॻ͍ͯΤϯλʔԡ͚ͩ͢ʂ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ ࣮ߦ͢Δͱɺ[ϓϩδΣΫτ໊] ʹࢦఆ໊ͨ͠લͷσΟϨΫτϦ͕৽ͨʹ࡞ ͞Ε·͢ɻ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ ࣮ߦ͢Δͱɺ[ϓϩδΣΫτ໊] ʹࢦఆ໊ͨ͠લͷσΟϨΫτϦ͕৽ͨʹ࡞ ͞Ε·͢ɻ ӈਤɺ`middleman init example` Ͱ࡞ͨ͠ϓϩδΣΫτ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ middleman init [ϓϩδΣΫτ໊] -T [ςϯϓϨʔτ໊] middleman init [ϓϩδΣΫτ໊]
--template=[ςϯϓϨʔτ໊] or ϓϩδΣΫτςϯϓϨʔτΛ͍ɺ༷ʑͳεέϧτϯΛ࡞Δࣄ͕ՄೳͰ͢ɻ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ • σϑΥϧτͰೖͬͯΔϓϩδΣΫτςϯϓϨʔτ • HTML5 Boilerplate • SMACSS •
Mobile Boilerplate • ίϛϡχςΟϓϩδΣΫτςϯϓϨʔτ IUUQEJSFDUPSZNJEEMFNBOBQQDPNUFNQMBUFTBMM • ಠࣗϓϩδΣΫτςϯϓϨʔτ ~/.middleman/ ʹߋʹσΟϨΫτϦΛ࡞ͬͯಠࣗͷϓϩδΣΫτς ϯϓϨʔτΛՃ͢ΔࣄՄೳͰ͢ɻ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ middleman server ϓϩδΣΫτ͔Βɺʰࠇ͍ը໘ʱΛͬͯ ԼͷҰߦΛॻ͍ͯΤϯλʔԡ͚ͩ͢ʂ 139݄20༵ۚ
bundle exec middleman server 3-2. ϓϨϏϡʔαʔόͷىಈ middleman `server` লུ͢ΔࣄՄೳͰ͢ɻ ڥʹΑͬͯɺઌͷೋͭͷίϚϯυͰΤϥʔ͕ൃੜ͢Δ߹͕͋Γ·͢ɻ
ͦͷ߹ɺ`bundle exec` Λઌ಄ʹ͚࣮ͯߦ͍ͯͩ͘͠͞ɻ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ http://0.0.0.0:4567/ or http://localhost:4567/ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ http://0.0.0.0:4567/ or http://localhost:4567/ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ http://0.0.0.0:4567/ or http://localhost:4567/ 139݄20༵ۚ
3-2. ϓϨϏϡʔαʔόͷىಈ http://0.0.0.0:4567/ or http://localhost:4567/ 139݄20༵ۚ
3-3. Ϗϧυ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ 139݄20༵ۚ
3-1. ϓϩδΣΫτͷ࡞ middleman build ϓϩδΣΫτ͔Βɺʰࠇ͍ը໘ʱΛͬͯ ʢҎԼུʣ 139݄20༵ۚ
ڥʹΑͬͯɺઌ΄ͲͷίϚϯυͰΤϥʔ͕ൃੜ͢Δ߹͕͋Γ·͢ɻ ͦͷ߹ɺ`bundle exec` Λઌ಄ʹ͚࣮ͯߦ͍ͯͩ͘͠͞ɻ 3-3. Ϗϧυ bundle exec middleman build
Ϗϧυʹޭ͢Δͱɺ:build_dirʢσϑΥϧτ buildʣʹ੩తϑΝΠϧΛ ॻ͖ग़͠·͢ɻ 139݄20༵ۚ
3-4. ͓͞Β͍ 139݄20༵ۚ
3-4. ͓͞Β͍ middleman init my_project ϓϩδΣΫτΛ࡞ͬͯ 139݄20༵ۚ
3-4. ͓͞Β͍ middleman init my_project ϓϩδΣΫτΛ࡞ͬͯ cd my_project ࡞ͬͨϓϩδΣΫτʹҠಈͯ͠ 139݄20༵ۚ
3-4. ͓͞Β͍ middleman init my_project ϓϩδΣΫτΛ࡞ͬͯ cd my_project ࡞ͬͨϓϩδΣΫτʹҠಈͯ͠ middleman
server ϓϨϏϡʔαʔόΛىಈ͢Δ middleman build Ϗϧυ͢Δ or 139݄20༵ۚ
3-4. ͓͞Β͍ middleman init my_project ϓϩδΣΫτΛ࡞ͬͯ cd my_project ࡞ͬͨϓϩδΣΫτʹҠಈͯ͠ middleman
server ϓϨϏϡʔαʔόΛىಈ͢Δ middleman build Ϗϧυ͢Δ or ऴΘΓ 139݄20༵ۚ
4. ͦͷଞ 139݄20༵ۚ
4. ͦͷଞ ςϯϓϨʔτΤϯδϯɾϓϦϓϩηοα • ERb • Haml • Sass •
Slim • Erubis • Less CSS • Builder • Liquid • RDiscount • Redcarpet • BlueCloth • Kramdown • Maruku • RedCloth • RDoc • Radius • Markaby • Nokogiri • CoffeeScript • Creole (Wiki markup) • WikiCloth (Wiki markup) • Yajl • Stylus 139݄20༵ۚ
4. ͦͷଞ ֦ுػೳ • sprockets • frontmatter • cache_buster •
relative_assets • asset_host • minify_css • minify_javascript • gzip • assert_hash • directory_indexes • automatic_image_sizes • i18n • livereload ͳͲͳͲ… 139݄20༵ۚ
5. ·ͱΊ 139݄20༵ۚ
• ϓϩδΣΫτςϯϓϨʔτͰ࡞ۀ͕࢝Ίқ͍ • ϩʔΧϧ Web αʔό͕༻ҙ͞Ε͍ͯΔ • ςϯϓϨʔτΤϯδϯɺ ϓϦϓϩηοαʹରԠ •
LiveReload HTML, CSS, JS ͷ minifyɺ gzip ѹॖͱݴ֦ͬͨுػೳ͕͑Δ • ެࣜαΠτͷ༁͕͋Δʢॏཁʣ 5. ·ͱΊ 139݄20༵ۚ
5. ·ͱΊ ͱʹ͔͘؆୯ɻ આ໌͖͠Ε͍ͯͳ͍ػೳࢁɻ ڵຯ͕ग़ͨΒ༁αΠτΛݟ͍ͯͩ͘͞ɻ http://middleman-guides.e2esound.com/ ੩తαΠτδΣωϨʔλଞʹ͔ͳΓͷ͋Γ·͢ɻ ͍ൺͯࣗʹ߹ͬͨΛݟ͚ɺ໘ͳ࡞ۀΛָʹ͠· ͠ΐ͏ɻ 139݄20༵ۚ
Ҏ্ ͋Γ͕ͱ͏͍͟͝·ͨ͠ 139݄20༵ۚ