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

Drupal テーマ開発入門講座 第3回 ベーステーマとサブテーマ

Drupal テーマ開発入門講座 第3回 ベーステーマとサブテーマ

More Decks by アクイアジャパン Acquia Japan

Other Decks in Programming

Transcript

  1. ϕʔεςʔϚͱαϒςʔϚ – ϕʔεςʔϚ – αϒςʔϚͷ਌ͱͳΔςʔϚͰ͢ɻ – ελʔλʔςʔϚͱ΋ݺ͹Ε·͢ɻ 
 – αϒςʔϚ

    – ͋ΔϕʔεςʔϚΛݩʹ࡞ΒΕͨςʔϚΛαϒςʔϚͱݺͼ·͢ɻ – *.info.yml ͷ base theme ΩʔͰϕʔεςʔϚΛࢦఆ͠·͢ɻ – ྫʣbase theme: stable – ϕʔεςʔϚ͕࣋ͭελΠϧ΍ςϯϓϨʔτͳͲͷҰ෦ͷߏ੒Λܧঝ͠ ͳ͕ΒΧελϚΠζͰ͖·͢ɻ – αϒςʔϚ͸ผͷαϒςʔϚͷࢠʹ͢Δ͜ͱ͕ՄೳͰ͢ɻ
  2. αϒςʔϚ͕ܧঝ͢ΔϦιʔε – *.theme – *.breakpoints.yml – ςϯϓϨʔτϑΝΠϧ(*.html.twig) – εΫϦʔϯγϣοτ –

    ը૾ – CSS – JavaScript ϕʔεςʔϚʹ*.libraries.yml ͕ଘࡏ͢Δ৔߹ɺܧঝ͞Ε·͢ɻ
  3. αϒςʔϚ͕ܧঝ͠ͳ͍Ϧιʔε – *.info.yml – ϕʔεςʔϚ͕࢖༻͞Ε͍ͯΔ͔Ͳ͏͔ʹݶΒͣɺશͯͷςʔϚʹ͸ *.info.yml͕ඞ ཁͰ͢ɻ – Ϧʔδϣϯ –

    ϕʔεςʔϚͷϦʔδϣϯΛར༻͍ͨ͠৔߹͸ɺ*.info.ymlʹϦʔδϣϯઃఆΛί ϐʔ͢Δ͜ͱͰߦ͍·͢ɻ – ColorϞδϡʔϧ – logo.svg – favicon.ico
  4. ϕʔεςʔϚͷࢦఆํ๏ name: Marucha type: theme description: '·Δ஡ͷͨΊͷΧελϜςʔϚ' core_version_requirement: ^8 ||

    ^9 base theme: classy *.info.yml ͷbase themeΩʔʹ਌ʹ͍ͨ͠ςʔϚͷϚγϯ໊Λࢦఆ͢Δ͜ͱͰϕʔ εςʔϚΛࢦఆ͠·͢ɻ ྫʣϕʔεςʔϚʹίΞͷClassyςʔϚΛ࢖༻͢Δ৔߹
  5. ίΞςʔϚΛϕʔεςʔϚʹར༻͢Δ – Classy – Stable͕ϕʔεςʔϚͱͯ͠ࢦఆ͞Ε͓ͯΓɺStableΛ֦ுͯ͠ɺϞμϯͳϨΠΞ΢τΛ࣮ݱ͢ ΔͨΊʹ໾ཱͭଟ͘ͷΫϥε͕༻ҙ͞Ε͍·͢ɻ – ΧελϜςʔϚΛ࡞੒͢ΔࡍͷϕʔεςʔϚͱͯ͠ར༻Ͱ͖·͢ɻ 
 –

    Stable – Classyಉ༷ɺΧελϜςʔϚΛ࡞੒͢ΔࡍͷϕʔεςʔϚͱͯ͠ར༻Ͱ͖·͢ɻ࠷খݶͷCSSΫ ϥεͰΑΓΫϦʔϯͳΞϓϩʔνΛऔΓ͍ͨ৔߹ʹબ୒͞Ε·͢ɻ – Stableͱ͸ผʹɺDrupal 9͔ΒStable 9(stable9)ͱ͍͏ίΞςʔϚ͕༻ҙ͞Ε·ͨ͠ɻStable͔Β ͍͔ͭ͘ͷมߋ͕Ճ͑ΒΕ͍ͯ·͢ɻStable͸Drupal 10Ͱ࡟আ͞ΕΔ༧ఆͰ͢ɻ 
 – Stark – ओʹಈ࡞֬ೝɺτϥϒϧγϡʔςΟϯάΛ໨తͱͯ͠ఏڙ͞Ε·͢ɻCSS͸ઃఆ͞Ε͍ͯ·ͤ Μɻ
  6. ίϛϡχςΟͰఏڙ͞ΕΔϕʔεςʔϚͷྫ https://www.drupal.org/project/project_theme ͔Β୳͢͜ͱ͕Ͱ͖·͢ɻ – Barrio – Bootstrapόʔδϣϯ4/5ʹରԠͨ͠ϕʔεςʔϚɻ 
 – Radix

    – Bootstrapόʔδϣϯ4/5ɺSassɺES6, BrowserSync͕૊Έࠐ·ΕͨϕʔεςʔϚɻ 
 – W3CSS Theme – W3.CSSϑϨʔϜϫʔΫΛར༻ͨ͠ϕʔεςʔϚɻ
  7. ࢀߟ) Drupal 10ͰͷςʔϚ։ൃ • Classyͷஔ͖׵͑Λ໨తͱͯ͠ɺ৽͍͠ΧελϜςʔϚͷ࡞੒ϓϩηεͱϕʔεςʔϚΛܭը • ελʔλʔΩοτςʔϚ͸αϒςʔϚͷϕʔεςʔϚͱͯ͠ػೳ͢ΔͷͰ͸ͳ͘ɺςʔϚΛ৽͘͠࡞੒ ͢Δࡍʹίϐʔ͞ΕΔςʔϚͱͯ͠ػೳ͢Δ • ςʔϚΛίϐʔ͢ΔͨΊͷίϚϯυΛDrupalίΞͰఏڙ

    ◦ $ php core/scripts/drupal generate-theme mytheme ςʔϚ։ൃͷͨΊͷελʔλʔΩοτ͕ొ৔ https://www.drupal.org/about/core/blog/new-starterkit-will-change-how-you-create-themes-in-drupal-10 https://www.drupal.org/project/drupal/issues/3050384