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
Drupal Zen テーマ 7.x-6.x について
Search
GOTO Hayato
December 16, 2016
Technology
0
91
Drupal Zen テーマ 7.x-6.x について
Drupal 7 の定番ベーステーマのひとつ Zen のバージョン 7.x-6.x についてポイントをかいつまんでご説明します。
GOTO Hayato
December 16, 2016
Tweet
Share
More Decks by GOTO Hayato
See All by GOTO Hayato
Drupal のコア / モジュールへのコントリビュート方法について
gh640
0
610
Other Decks in Technology
See All in Technology
SREチームをどう作り、どう育てるか ― Findy横断SREのマネジメント
rvirus0817
0
320
茨城の思い出を振り返る ~CDKのセキュリティを添えて~ / 20260201 Mitsutoshi Matsuo
shift_evolve
PRO
1
360
【Oracle Cloud ウェビナー】[Oracle AI Database + AWS] Oracle Database@AWSで広がるクラウドの新たな選択肢とAI時代のデータ戦略
oracle4engineer
PRO
2
180
What happened to RubyGems and what can we learn?
mikemcquaid
0
310
Cosmos World Foundation Model Platform for Physical AI
takmin
0
950
配列に見る bash と zsh の違い
kazzpapa3
3
160
コミュニティが変えるキャリアの地平線:コロナ禍新卒入社のエンジニアがAWSコミュニティで見つけた成長の羅針盤
kentosuzuki
0
130
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
5.6k
顧客の言葉を、そのまま信じない勇気
yamatai1212
1
360
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
SchooでVue.js/Nuxtを技術選定している理由
yamanoku
3
160
M&A 後の統合をどう進めるか ─ ナレッジワーク × Poetics が実践した組織とシステムの融合
kworkdev
PRO
1
480
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
940
BBQ
matthewcrist
89
10k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
67
Crafting Experiences
bethany
1
50
Designing for Performance
lara
610
70k
Accessibility Awareness
sabderemane
0
56
エンジニアに許された特別な時間の終わり
watany
106
230k
Designing Experiences People Love
moore
144
24k
The SEO Collaboration Effect
kristinabergwall1
0
350
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Designing for humans not robots
tammielis
254
26k
Transcript
Drupal Zen ςʔϚ 7.x-6.x ʹ͍ͭͯ
ࣗݾհ
ޙ౻Ͱ͢ • Drupal ΤϯδχΞ • ࣎լ
Zen 7.x-6.x
Zen
Zen Drupal ͷίϯτϦϏϡʔτςʔϚ • ͬͱਓؾͷߴ͍ςʔϚͷͻͱͭͰ͢ • ϕʔεςʔϚઐ༻ͷςʔϚͰ͢ • ֤छศརػೳ͕͍͍ͭͯ·͢
Zen 7.x-6.x
Zen 7.x-6.x 2016 य़ࠒʹϦϦʔε͞Ε·ͨ͠ • 7.x-5.x ͔Βେ෯ʹػೳՃ • 7.x-5.x ͷػೳͦͷ··
• SASS • Zen Grids • Drush ʹΑΔαϒςʔϚͻͳ͕ͨੜ
Zen 7.x-5.x
Zen 7.x-5.x • SASS: ͓ͳ͡ΈͷΞϨͰ͢ʢ Ruby ϕʔεʣ • Zen Grids:
ʢޙड़͠·͢ʣ • Drush ʹΑΔαϒςʔϚͻͳ͕ͨੜ: $ drush en zen # Zen ͷμϯϩʔυ & ༗ޮԽ $ drush cc all # ΩϟογϡΫϦΞ $ drush zen my_subtheme # => Zen ͷαϒςʔϚͷੜ
Zen 7.x-6.x
Zen 7.x-6.x ͜Μͳมߋ͕͋Γ·͢ • ϑΝΠϧׂ - SMACSS • ελΠϧΨΠυ -
KSS • λεΫϥϯφʔ - Gulp • ϥΠϒϥϦ - SASS • Ϋϥε໋໊ϧʔϧ - MindBEMding
Zen 7.x-6.x gulpfile.js ͷத
Zen 7.x-6.x gulpfile.js ͷத • autoprefixer • styleGuide • eslint
• BrowserSync • kss
Zen 7.x-6.x SASS ϑΝΠϧߏ
$ drush dl zen-7.x
Zen 7.x-6.x શϑΝΠϧ
Zen 7.x-6.x SASS ϑΝΠϧߏ sass: - styles.scss - _init.scss -
init/ - _colors.scss - _variables.scss - base/ - layouts/ - components/ - navigation/ - forms/
Zen 7.x-6.x SASS ϑΝΠϧߏ sass: - styles.scss (1) - _init.scss
(2) - init/ (2) - _colors.scss (2) - _variables.scss (2) - base/ (3) - layouts/ (4) - components/ (5) - navigation/ (6) - forms/ (7)
Zen 7.x-6.x SASS ϑΝΠϧߏ styles.scss (1): • ͦͷଞͷϑΝΠϧΛಡΈࠐΜͰશମΛ·ͱΊΔ
Zen 7.x-6.x SASS ϑΝΠϧߏ _init.scss (2): init/ (2): • ॳظԽॲཧΛߦ͏
• ֤छϥΠϒϥϦΛಡΈࠐΉ • Breakpoint / chroma / support-for / typey / zen-grids
Zen 7.x-6.x SASS ϑΝΠϧߏ • Breakpoint: ϒϨʔΫϙΠϯτʢϝσΟΞΫΤϦʣ • chroma: ৭
• support-for: ରϒϥβ • typey: ϑΥϯτ • zen-grids: ϨΠΞτ
ϥΠϒϥϦ
ϥΠϒϥϦ: Breakpoint ϝσΟΞΫΤϦʢϒϨʔΫϙΠϯτʣཧ༻ͷϥΠϒϥϦ https://github.com/at-import/breakpoint • ਓ͕ؒಡΈ͍͢ϝσΟΞΫΤϦ
ϥΠϒϥϦ: Breakpoint $pc: 960px; $tablet: 456px 794px; #foo { content:
'No Media Queries'; // Λ 1 ͭ͢ͱ min-width ʹͳΔ @include breakpoint($pc) { content: 'Basic Media Query'; } // Λ 2 ͭ͢ͱ min-width ͱ max-width ʹͳΔ @include breakpoint($tablet) { content: 'Paired Media Query'; } }
ϥΠϒϥϦ: Chroma ৭ใཧͷͨΊͷϥΠϒϥϦ http://johnalbin.github.io/chroma • ΧϥʔηοτʢʮεΩʔϜʯʣͷఆٛ • εΩʔϜͷܧঝ
ϥΠϒϥϦ: Chroma ఆٛ: ϕʔεεΩʔϜ @import "chroma"; // σϑΥϧτͷΧϥʔεΩʔϜΛఆٛ $chroma: define-default-color-scheme('ϒϥϯυΧϥʔΛఆٛɻ');
// σϑΥϧτΧϥʔεΩʔϜʹ৭ΛՃ $chroma: add-colors(( black: #000, red: #c00, // "blue" ͷΛ࣋ͭϋΠϥΠτΧϥʔΛఆٛ // ϝϞ: Ҿ༻ූͳ͠Ͱ blue ͕ࢦఆ͞Εͨ߹มͷࢀরͰͳ͘௨ৗͷ৭ͱղऍ͞ΕΔ primary: 'blue', ));
ϥΠϒϥϦ: Chroma ఆٛ: ࢠεΩʔϜ // ʮϑΝϯΫγϣφϧʯͳΧϥʔεΩʔϜΛ࡞ // σϑΥϧτΧϥʔεΩʔϜΛܧঝ͢Δ $chroma: define-color-scheme('functional',
'࣮ࡍʹར༻͢ΔΧϥʔεΩʔϜΛఆٛɻ'); // ϑΝϯΫγϣφϧΧϥʔεΩʔϜʹ৭ΛՃ $chroma: add-colors('functional', ( // text ͷΧϥʔΛσϑΥϧτΧϥʔεΩʔϜͰఆٛ͞Εͨ black ͷ৭ʹ͢Δ text: 'black', // ଞͷ৭ͷ໊લҾ༻ූ͋ΓͰͳ͠ͰͲͪΒͰ OK // ϝϞ: Ҿ༻ූΛ͚ͭͳ͚Ε৭ͷΩʔϫʔυจࣈྻͱͯ͠ೝࣝ͞Εͳ͍ heading: text, // ϦϯΫ৭ΛϓϥΠϚϦʔΧϥʔʹ͢Δ link: primary, // ϦϯΫϑΥʔΧεΧϥʔΛ lighten(link, 20%) Ͱઃఆ͢Δ link-focus: (link lighten 20%), ));
ϥΠϒϥϦ: Chroma ఆٛ: ଙεΩʔϜ // "alternate" ΧϥʔεΩʔϜΛ࡞ // functional ͔Βܧঝ
$chroma: define-color-scheme('alternate', 'ସΧϥʔεΩʔϜΛఆٛɻ', $parent: 'functional'); // alternate ΧϥʔεΩʔϜʹ৭ΛՃ $chroma: add-colors('alternate', ( primary: 'red', ));
ϥΠϒϥϦ: Chroma ར༻: // color() ͕ؔݺΕͨͱ͖ʹͲͷΧϥʔΛσϑΥϧτͰ༻͢Δ͔Ληοτ͢Δ $chroma-active-scheme: 'functional'; .example-ruleset {
h1 { // #000 color: color(heading); } a { // #0e71b8 color: color(link); .alternate-color-section & { // #c00 ʢͷ৭ʹϑΥʔϧόοΫʣ color: color(alternate, link); } } }
ϥΠϒϥϦ: support-for ϒϥβαϙʔτཧͷͨΊͷϥΠϒϥϦ https://github.com/JohnAlbin/support-for
ϥΠϒϥϦ: support-for ઃఆ: $support-for: ( // ϚΠφε࠷৽ͷόʔδϣϯ͔Βͷόʔδϣϯ chrome: -4, edge:
25, firefox: 45, ie: 9, opera: -4, safari: -4, '*': -4, ) !default; $support-for: ( safari: 8, // null αϙʔτͳ͠Λҙຯ͢Δ // ࢦఆ͞Ε͍ͯͳ͍ϒϥβͷσϑΥϧτ '*': null, );
ϥΠϒϥϦ: support-for ར༻: @mixin my-sweet-sweet-mixin($cocoa: lots) { border-radius: 100%; //
͜͜ IE 10 αϙʔτͷͨΊʹಡΈࠐ·ΕΔ @if support-for(ie, 10) { // IE 8/9/10 Ͱ a ͷ a ཁૉͷϘʔμʔΛআ͢Δ border: 0; } }
ϥΠϒϥϦ: typey ϑΥϯτؔ࿈ͷใΛཧ͢ΔͨΊͷϥΠϒϥϦ https://github.com/jptaranto/typey • ϑΥϯτઃܭͷར༻
ϥΠϒϥϦ: typey ઃఆ: ϑΥϯταΠζ $base-font-size: 15px; $font-size: ( xxl: 32px,
xl: 24px, l: 18px, m: $base-font-size, s: 12px, xs: 10px );
ϥΠϒϥϦ: typey ར༻: ϑΥϯταΠζ abbr { @include font-size(s); }
ϥΠϒϥϦ: typey ઃఆ: ϑΥϯτϑΝϛϦʔ $typefaces: ( sans-serif: ( font-family: $helvetica,
letter-spacing: -.5px, ), serif: $garamond, monospace: ( font-family: $monaco, letter-spacing: .5px, weight: bold, case: uppercase, ) );
ϥΠϒϥϦ: typey ར༻: ϑΥϯτϑΝϛϦʔ h1, h2, h3 { @include typeface(body);
}
ϥΠϒϥϦ: typey ઃఆ: ϑΥϯτपΓશൠ $typestyles: ( heading-1: ( font-size: xl,
line-height: 1.25, weight: bold, case: uppercase ), heading-2: ( font-size: l, line-height: 1.25, weight: normal ) )
ϥΠϒϥϦ: typey ར༻: ϑΥϯτपΓશൠ h1 { @include typeset(heading-1); }
ϥΠϒϥϦ: typey ઃఆ: Φϓγϣϯ $base-unit: 'rem';
ϥΠϒϥϦ: Zen Grids άϦουϨΠΞτͷͨΊͷϥΠϒϥϦ http://zengrids.com • άϦουϨΠΞτΛ͓खܰʹ࣮ݱ
ϥΠϒϥϦ: Zen Grids ઃఆ: import "zen-grids"; // ΧϥϜ $zen-columns: 7;
// ΨλʔαΠζ: ֤ΧϥϜͷ྆αΠυʹΨλʔͷͷۭന͕ೖΔ $zen-gutters: 10px;
ϥΠϒϥϦ: Zen Grids ར༻: HTML <div class="container"> <article class="content"> Tha
main content. We like semantic HTML ordering. </article> <aside class="aside1"> An aside. </aside> <aside class="aside2"> Another aside. </aside> <footer class="footer1"> A footer. </footer> <footer class="footer2"> Another footer. </footer> </div>
ϥΠϒϥϦ: Zen Grids ར༻: SCSS .container { // άϦουίϯςφ @include
zen-grid-container(); } .aside1 { // ෯͕ 2 ΧϥϜɺελʔτ͕ 1 ΧϥϜ @include zen-grid-item(2, 1); } .content { // ෯͕ 4 ΧϥϜɺελʔτ͕ 3 ΧϥϜ @include zen-grid-item(4, 3); } .aside2 { // ෯͕ 1 ΧϥϜɺελʔτ͕ 7 ΧϥϜ @include zen-grid-item(1, 7); }
ϥΠϒϥϦ: Zen Grids ར༻: SCSS .footer1 { // ৽͍͠ߦΛ࢝ΊΔ @include
zen-new-row(); // ෯͕ 3 ΧϥϜɺελʔτ͕ 5 ΧϥϜ // ඞͣ͠ࠨ͔Βॱʹ٧Ίͳͯ͘ OK @include zen-grid-item(3, 5); } .footer2 { // ෯͕ 4 ΧϥϜɺελʔτ͕ 1 ΧϥϜ @include zen-grid-item(4, 1); }
Zen 7.x-6.x SASS ϑΝΠϧߏ
Zen 7.x-6.x SASS ϑΝΠϧߏ _colors.scss (2): • ৭ؔ࿈ͷมʢ chroma ʣΛఆٛ͢Δ
_variables.scss (2): • ৭Ҏ֎ͷมΛఆٛ͢Δ
Zen 7.x-6.x SASS ϑΝΠϧߏ base/ (3) : layouts/ (4) :
components/ (5) : • SMACSS ෩ͷϨΠϠϦϯά navigation/ (6) : forms/ (7) : • ͜͜ SMACSS ෩͡Όͳ͍ • ϝχϡʔϑΥʔϜपΓ
͋Γ͕ͱ͏͍͟͝·ͨ͠