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

Yet Another CSS Preprocessor

Yet Another CSS Preprocessor

Frontrend Conference でのLT資料です。

YACP
https://github.com/morishitter/YACP
YACP: よりオブジェクト指向なCSS設計のためのCSSプリプロセッサ
http://morishitter.hatenablog.com/entry/2014/12/02/000135

Masaaki Morishita

February 22, 2015
Tweet

More Decks by Masaaki Morishita

Other Decks in Programming

Transcript

  1. Aout me 4 ৿Լ խষ / Masaaki Morishita 4 twitter:

    @morishitter_ 4 github: morishitter 4 blog: http://morishitter.hatenablog.com 4 େֶӃ M2 4 4݄͔ΒαΠόʔΤʔδΣϯτʹೖࣾ
  2. ҆શͳ @extend %base-1 { font-size: 12px; padding: 8px 12px; }

    %base-2 { font-size: 14px; } .foo { /* Error */ extend: %base-1; extend: %base-2; }
  3. ৄࡉ౓ͷ౷Ұ (Φϓγϣϯ) ΫϥεηϨΫλͱͦΕʹ෇ਵ͢ΔٖࣅηϨΫλҎ ֎Λېࢭ .class {} /* OK */ .class:hover

    {} /* OK */ #id {} /* NG */ p {} /* NG */ .class .nested {} /* NG */ .class { color: red !important; /* NG */ }
  4. ϧʔϧηοτͷΧϓηϧԽ (.text) { font-size: 12px; color: red; } .text {

    /* Error */ font-size: 14px; } .foo .text { /* Error */ color: blue; } ΧεέʔσΟϯάΛېࢭ
  5. privateͳϧʔϧηοτ %base { font-size: 12px; } .foo { extend: %base;

    } %base { /* Error */ font-size: 14px; } privateͳ(্ॻ͖ෆՄೳͰ͔ͭYACPϑΝΠϧ಺ ͰͷΈࢀরՄೳ)ͳϧʔϧηοτΛఆٛͰ͖Δ