CSS lessãªéçºã®ã¹ã¹ã¡
å人çã«Webç³»ã®æè¡ã§æ°ã«å
¥ã£ã¦ããã¨ã®ä¸ã¤ã«HTMLã¨JSã¨CSSã«ãããæ§é ãæ¯ãèãããã¶ã¤ã³ã®åé¢ãããã
ããã¯ããªãèªåã®ä¾¡å¤è¦³ã«ãããããããã ããã¶ã¤ã³ãæ
ãCSSãPoorãããã®ãåé¡ç¹ã
ã¨ãã£ã¦ã表ç¾åã®è©±ãããªããCSS3ã¯ããªã表ç¾åãæã£ã¦ããããååãä»æ§æ¸ãåºæ¥ãã»ã©ã®è±å¯ãªæ©è½ãæã£ã¦ããã
ããããä½ãå¾®å¦ãã¨ããã¨è¨è¿°åãç§ã¿ãããªã«ããããã°ã©ããèªåã®ãµã¤ãç¨ã«ã¡ãã£ã¨ãã¶ã¤ã³ãçµããã¨ããã¨CSSã®è¤éãã«æ³£ãã¾ããã¨ããããå¤æ°ã使ããªãã®ã§ãåãè¨å®å¤ãã³ãããã¾ããã¨ããæ®å¿µä»æ§ã
ã¨ããããã§ãããã§lessã§ããï¼
ããã¯ãCSSã«æ§é åãå¤æ°ãªã©æ§ã ãªæ¡å¼µãæ½ããç´ æµã©ã¤ãã©ãªã
ä¸è¨ã¯æ¬å®¶ã®ãµã³ãã«
@base: #f938ab; .box-shadow(@style, @c) when (iscolor(@c)) { box-shadow: @style @c; -webkit-box-shadow: @style @c; -moz-box-shadow: @style @c; } .box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) { .box-shadow(@style, rgba(0, 0, 0, @alpha)); } .box { color: saturate(@base, 5%); border-color: lighten(@base, 30%); div { .box-shadow(0 0 5px, 30%) } }
æ§é åããããã¯ã§ã表ç¾ã§ããã®ã§ããªãããããããã
ã¾ããå¤æ°ã®å©ç¨ã¯ãã¡ãããããã¯ã¹ã¤ã³ã¨ããé¢æ°ã©ã¤ã¯ãªä»æ§ãããã®ã§ãé¨ååãããªããããããªãã¾ãã
ã¨ãã«ããã¯ã¹ã¤ã³ã¯ãµã³ãã«ã«ããããã«åãã©ã¦ã¶åºæã®ããããã£ãæ½è±¡åã§ããã®ãé
å ã
使ãæ¹ã¯ç°¡åã§ãä¸è¨ã®æãã®ããããã¤ããã°OK.
<ink rel="stylesheet/less" href="/css/main.less" type="text/css"/> <script src="/js/less-1.3.0.js" type="text/javascript"</script>
ã³ãã³ãã§CSSã«å¤æãããã¨ãã§ãã¦ããã£ã¡ãåºæ¬çã«æ¨å¥¨ãªãã ãã©ãjsãèªã¿è¾¼ããã¨ã§ãªã¢ã«ã¿ã¤ã ã«å¤æã§ããã®ã§ãå°ãªãã¨ãéçºä¸ã¯ããã§åé¡ãªãã¯ãã
SCSSã¨ããã»ã¼åãã³ã³ã»ããã®ä»æ§ã§ããã©ãJSã«ããå¤æã§æ軽ã«å©ç¨ã§ããåä»ã¯lessã使ç¨ãã¦ãã¾ãã
less + CoffeeScriptãWebéçºã®ã¡ã¤ã³ã¹ããªã¼ã ã«ãªãã¨å¬ãããªãã
ã¡ãªã¿ã«ã詳ãã使ãæ¹ã¨ãã¯ãä¸è¨ã®ãµã¤ããåèã«ãã¦ä¸ãã
http://dxd8.com/archives/217/