Upgrade to Pro — share decks privately, control downloads, hide ads and more …

最近流行り?の Middleman でモダンな Web 開発

2no
September 21, 2013
1.2k

最近流行り?の Middleman でモダンな Web 開発

Middleman のインストール、プロジェクトの作成やローカル Web サーバを使った開発方法を簡単に説明します。

2no

September 21, 2013
Tweet

Transcript

  1. • ೋٶ ࿨ಙ (χϊϛϠ ΧζϊϦ) • Twitter: @wakuworks • גࣜձࣾ

    ಼ • ීஈ͸ PHP Λ͍ͬͯ͡·͢ɻ 13೥9݄20೔༵ۚ೔
  2. • ೋٶ ࿨ಙ (χϊϛϠ ΧζϊϦ) • Twitter: @wakuworks • גࣜձࣾ

    ಼ • ීஈ͸ PHP Λ͍ͬͯ͡·͢ɻ ʢRuby ͸ͬ͞ͺΓΘ͔Γ·ͤΜʣ 13೥9݄20೔༵ۚ೔
  3. 1. Middleman ͱ͸ʁ 2. Πϯετʔϧ 3. ։ൃͷྲྀΕ 1. ϓϩδΣΫτͷ࡞੒ 2.

    ϓϨϏϡʔαʔόͷىಈ 3. Ϗϧυ 4. ͓͞Β͍ 4. ͦͷଞ 5. ·ͱΊ ΞδΣϯμ 13೥9݄20೔༵ۚ೔
  4. 1. Middleman ͱ͸ʁ Middleman ͸Ϟμϯͳ web ։ൃ؀ڥͷ͢΂ͯͷ γϣʔτΧοτ΍πʔϧΛ࢖༻ͯ͠੩త web αΠ

    τΛ࡞੒͢ΔͨΊͷίϚϯυϥΠϯπʔϧͰ͢ɻ Ҿ༻ɿhttp://middleman-guides.e2esound.com/getting-started/ l z ॴҦɺ੩తαΠτδΣωϨʔλͷҰͭͰ͢ɻ WEB ։ൃΛγϯϓϧ׌ͭߴ଎ʹͯ͘͠Ε·͢ɻ ࣅͨ෺Ͱ͸ Jekyll ͕༗໊Ͱ͢ɻ 13೥9݄20೔༵ۚ೔
  5. • Mac 2. Πϯετʔϧ gem install middleman Xcode Command Line

    Tool ͕ඞཁͰ͢ɻ Xcode ܦ༝ͰΠϯετʔϧ͢Δ͔ɺσϕϩούϙʔλϧ͔Β௚઀ύοέʔ δΛμ΢ϯϩʔυ͢Δඞཁ͕͋Γ·͢ɻ Xcode Command Line Tool ͷΠϯετʔϧ͕׬ྃͨ͠Βɺ ޙ͸ԼͷίϚϯυΛ࣮ߦͯ͠Πϯετʔϧ͠·͢ɻ 13೥9݄20೔༵ۚ೔
  6. 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 13೥9݄20೔༵ۚ೔
  7. 2. Πϯετʔϧ • Windows ࠷ॳʹɺRuby, RubyGems ͸ೖ͍ͬͯ·ͤΜɻ ͜ΕΒ͸ࣗ෼ͰΠϯετʔϧ͠ͳ͚Ε͹ͳΓ·ͤΜɻ ▼Ruby, RubyGems

    ͷΠϯετʔϥ http://rubyinstaller.org/downloads/ RubyInstallers ͷ߲ʹμ΢ϯϩʔ υϦϯΫ͕͋Γ·͢ɻ޷͖ͳόʔδ ϣϯͷ෺Λམͱ͍ͯͩ͘͠͞ɻ ※ 1.8.7 Ҏ্Ͱ͋Ε͹໰୊ͳ͍ͱࢥ͍·͢ 13೥9݄20೔༵ۚ೔
  8. • Windows 2. Πϯετʔϧ ΠϯετʔϥΛىಈ͢Δͱɺ΢Οβʔυ͕։͖·͢ɻ಺༰ʹैͬͯਐΊͯ͘ ͍ͩ͞ɻ͜ΕͰ Ruby, RubyGems ͷΠϯετʔϧ͸׬ྃͰ͢ɻ ࣍ʹɺDEVELOPMENT

    KIT ΠϯετʔϧͰ͢ɻ ઌ΄Ͳͷμ΢ϯϩʔυϖʔδͷԼʹ DEVELOPMENT KIT ͷμ΢ϯϩʔυ ϦϯΫ͕͋Γ·͢ɻ 13೥9݄20೔༵ۚ೔
  9. 3-1. ϓϩδΣΫτͷ࡞੒ middleman init [ϓϩδΣΫτ໊] -T [ςϯϓϨʔτ໊] middleman init [ϓϩδΣΫτ໊]

    --template=[ςϯϓϨʔτ໊] or ϓϩδΣΫτςϯϓϨʔτΛ࢖͍ɺ༷ʑͳεέϧτϯΛ࡞Δࣄ͕ՄೳͰ͢ɻ 13೥9݄20೔༵ۚ೔
  10. 3-1. ϓϩδΣΫτͷ࡞੒ • σϑΥϧτͰೖͬͯΔϓϩδΣΫτςϯϓϨʔτ • HTML5 Boilerplate • SMACSS •

    Mobile Boilerplate • ίϛϡχςΟϓϩδΣΫτςϯϓϨʔτ IUUQEJSFDUPSZNJEEMFNBOBQQDPNUFNQMBUFTBMM • ಠࣗϓϩδΣΫτςϯϓϨʔτ ~/.middleman/ ʹߋʹσΟϨΫτϦΛ࡞ͬͯಠࣗͷϓϩδΣΫτς ϯϓϨʔτΛ௥Ճ͢Δࣄ΋ՄೳͰ͢ɻ 13೥9݄20೔༵ۚ೔
  11. 3-4. ͓͞Β͍ middleman init my_project ϓϩδΣΫτΛ࡞ͬͯ cd my_project ࡞ͬͨϓϩδΣΫτʹҠಈͯ͠ middleman

    server ϓϨϏϡʔαʔόΛىಈ͢Δ middleman build Ϗϧυ͢Δ or 13೥9݄20೔༵ۚ೔
  12. 3-4. ͓͞Β͍ middleman init my_project ϓϩδΣΫτΛ࡞ͬͯ cd my_project ࡞ͬͨϓϩδΣΫτʹҠಈͯ͠ middleman

    server ϓϨϏϡʔαʔόΛىಈ͢Δ middleman build Ϗϧυ͢Δ or ऴΘΓ 13೥9݄20೔༵ۚ೔
  13. 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 13೥9݄20೔༵ۚ೔
  14. 4. ͦͷଞ ֦ுػೳ • sprockets • frontmatter • cache_buster •

    relative_assets • asset_host • minify_css • minify_javascript • gzip • assert_hash • directory_indexes • automatic_image_sizes • i18n • livereload ͳͲͳͲ… 13೥9݄20೔༵ۚ೔
  15. • ϓϩδΣΫτςϯϓϨʔτͰ࡞ۀ͕࢝Ίқ͍ • ϩʔΧϧ Web αʔό͕༻ҙ͞Ε͍ͯΔ • ςϯϓϨʔτΤϯδϯɺ ϓϦϓϩηοαʹରԠ •

    LiveReload ΍ HTML, CSS, JS ͷ minifyɺ gzip ѹॖͱݴ֦ͬͨுػೳ͕࢖͑Δ • ެࣜαΠτͷ࿨༁͕͋Δʢॏཁʣ 5. ·ͱΊ 13೥9݄20೔༵ۚ೔