[泚 transã]ïŒGitHubéçºè
ãå
Twitteréçºè
ãæãæåãªCSS Bootstrapãã¬ãŒã ã¯ãŒã¯ã®äœæè
ã§ããMark Ottoã«ããèšäºã®ç¿»èš³ã«æ³šç®ããŠããŸãã ãã®èšäºã§ã¯ãGitHub CSSãããžã§ã¯ãã®å
éšæ§é ã«ã€ããŠèª¬æããŠããŸãã
ç§ã¯åžžã«ãä»ã®è£œåã®éçºããã»ã¹ã®è©³çŽ°ãç¹ã«ã¬ã€ãã©ã€ã³ãšCSSã®äœ¿çšæ¹æ³ã«èå³ããããŸããã ä»ã®äººã®CSSã³ãŒãã®è©³çŽ°ã奜ãã®ã§ãGitHubã§CSSã¢ãããŒãã«ã€ããŠæžãããšã«ããŸããã
ããã€ãã®äºå®
çŸåšã®CSSç¶æ
ã®æŠèŠïŒ
- ããªããã»ããµãšããŠãSCSSã䜿çšããŸãã
- æ¬çªç°å¢ã«å±éããåã«ã³ã³ãã€ã«ããã100ãè¶
ããã¹ã¿ã€ã«ã®ãœãŒã¹ãã¡ã€ã«ããããŸãã
- ãœãŒã¹ã¯2ã€ã®åå¥ã®CSSãã¡ã€ã«ã«ã³ã³ãã€ã«ãããŸãïŒIEã®ã»ã¬ã¯ã¿ãŒã®æ倧æ°ã®åé¡<10ãåé¿ããããïŒã
- ãããã®2ã€ã®ãã¡ã€ã«ã®åèšã¯çŽ90 kbã§ãã
- ç¹å¥ãªãCSSã¢ãŒããã¯ãã£ãã¯äœ¿çšããŸããã
- ãµã€ãºã決å®ããããã«ãã¯ã»ã«ãéžæããŸãããããŸã ããã€ãã®ãemãããããŸãã
- Normalize.cssãããã€ãã®ç¬èªã®ã¹ã¿ã€ã«ãšçµã¿åãããŠäœ¿çšââããŠãããããã£ããªã»ããããŸãã
ããªããã»ããµ
äžèšã®ããã«ãSCSSã䜿çšããŸãã ãã®éžæã¯ãéçºã«åå ãå§ããåããè¡ãããŠããŸããããããã«åæããŸãïŒBootstrapã¯LESSã§æžãããŠãããšããäºå®ã«ããããããïŒã SCSSã¯ãRailsã¢ã»ãããã€ãã©ã€ã³ãšã¹ããã±ããïŒçŸæç¹ã§ã¯ïŒã䜿çšããŠã³ã³ãã€ã«ããã³æ¥ç¶ãããŸãã 詳现ã¯åŸè¿°ããŸãã
LESSããŸãã¯ã¹ã¿ã€ã©ã¹ã¯ã©ãã§ããïŒ GitHubãLESSã«åãæ¿ãããšã¯æããªãã æãããªå©ç¹ããªãããããã®ç¹ã«é¢ããŠã¯äœãå€æŽããããªãã§ãããã
ããªããã»ããµãå¿
èŠãªçç± å
éšãã¬ãŒã ã¯ãŒã¯ã«ã¯ãäžé£ã®å€æ°ïŒãã©ã³ããäŒç€Ÿã®è²ãªã©ïŒãšäžçŽç©ïŒäž»ã«æ¥é èŸçšïŒãå«ãŸããŠãããã³ãŒãã®èšè¿°ããã»ã¹ãããè¿
éãã€ç°¡åã«ããŸãã çŸåš
Autoprefixerã䜿çšããŠããŸãããããããè¡ãã¹ãã§ããã ãããã£ãŠãæ¢åã®äžçŽç©ããã¹ãŠç¡å¹ã«ããããšãã§ããŸãã ç§ãã¡ã¯ããã«ãããè¡ãããšãé¡ã£ãŠããŸãã
ãœãŒã¹ãããã䜿çšããŠããŸãããããŸããªãå€æŽãããŸãã ïŒç¥ããªã人ã®ããã«ããœãŒã¹ãããã䜿çšãããšãã³ã³ãã€ã«æžã¿ãã¡ã€ã«ãçž®å°ãã¡ã€ã«ãšã¯ç°ãªããç¹å®ã®ã¹ã¿ã€ã«ã»ãããã©ã®ãœãŒã¹SCSSãã¡ã€ã«ãåç
§ããŠãããããããã¬ãŒã§ç¢ºèªã§ããŸãã
SCSSããŒã«ã®äœ¿çšã¯éåžžã«éãããŠããŸãã è²ãäžçŽç©ãè²ãæäœããé¢æ°ãæ°åŠé¢æ°ããã¹ãã¬ãã«ãå®çŸ©ããå€æ°ããããŸãã ã¯ã©ã¹ãç¹°ãè¿ãåŠçããããã°ããŒãã«èšå®ãäœæãããããå¿
èŠã¯ãããŸããã ç§ãã¡ãæã£ãŠããã·ã³ãã«ããæ°ã«å
¥ã£ãŠããŸãã
建ç¯
éåžžãCSSã¢ãŒããã¯ãã£ã¯BEMãŸãã¯OOCSSã§ãã OOCSSã«åŸåããŠããŸãããå
šäœçãªã¢ãããŒãã¯ãããŸããã åºæ¬çãªã«ãŒã«ã¯æ¬¡ã®ãšããã§ãã
- ãªãã·ã§ã³ã®æ·»ä»ãã¡ã€ã«ãé¿ãã
- ã¯ã©ã¹ã®åœåæã«ïŒåäžã®ïŒããã·ã¥ã䜿çšãã
- æ··åããªãããã«ãã§ããã ãå°ãªãæžã
- ç§ã奜ãCSSã¢ãŒããã¯ãã£ã«ã€ããŠã¯ãå¥ã®èšäºã§æžããŸãã çŸåšãç§ã¯GitHubã¢ãããŒãã«ã€ããŠèª¬æããŠããŸãããããã¯å®å
šã§ã¯ãããŸãããããã®ç®çãéåžžã«ããŸãæãããŠããŸãã
ã³ãŒãåââæ
æ°é±éåãã³ãŒãã¢ãã©ã€ã¶ãŒã¯äœ¿çšããŸããã§ããã ããã€ãã®å
±éã®åæããããŸããããåéçºè
ã«ã¯ç¬èªã®ã¹ã¿ã€ã«ããããç§ãã¡ããããã®ãã©ãŒãããã¯ãããŠããŒã¯ã§ããã çŸåšãåã¢ã»ã³ããªã¯SCSSã³ãŒãåæããã»ã¹ãééãã次ã®å Žåã«ã¯ã©ãã·ã¥ããŸãã
CSSã¯ãã¢ããª/ãã¥ãŒ/ãã³ãã¬ãŒãã§äœ¿çšãããªãã¯ã©ã¹ãèšè¿°ããŸãã
åãã»ã¬ã¯ã¿ãŒãè€æ°å䜿çšãããŸãïŒåžžã«çµåããå¿
èŠãããããïŒã
åºæ¬çãªæžåŒèšå®ã«ãŒã«ã«éåããŠããŸãïŒæ倧ãã¹ããã«ãŒã«ã»ããéã®æ¹è¡ãªã©ïŒã
äžè¬ã«ãã³ãŒãããŒã¹ãååã«æŽé ããããã®ããã€ãã®ã«ãŒã«ããããŸãã ã³ã¡ã³ãã®ã¹ã¿ã€ã«ãã¢ãŒããã¯ãã£ã®éãã¯èæ
®ãããŠããŸããããããã¯ãŸãã«ãã¹ãŠã®ããŒã ãå¿
èŠãšãããã®ã§ãã ãããŠãç§ãã¡äžäººäžäººãäœããæäŸããæ¹åããããšãã§ããŸãã
2ã€ã®ããã±ãŒãž
GitHubãããžã§ã¯ãã®CSSã¯ãgithubãšgithub2ã®2ã€ã®ãã¡ã€ã«ã§æ§æãããŠããŸãã ãã®åé¢ã¯ãIEã§ã®äœæ¥ã®åé¡ãââ解決ããããã«æ°å¹Žåã«è¿œå ãããŸãããããã¯ãã»ã¬ã¯ã¿ã®æ°ã1ãã¡ã€ã«ããã4.095ã«å¶éããŸãã ãã®å¶éã¯IE 9以åã®ããŒãžã§ã³ã«é©çšãããŸãã GitHubã®èŠä»¶ã¯IE9以äžã§ããããããã¡ã€ã«ãåå²ããå¿
èŠããããŸãã
çŸåšã2ã€ã®ãã¡ã€ã«ã¯çŽ7000ã®ã»ã¬ã¯ã¿ãŒã§æ§æãããŠããŸãã ããã¯ä»ã®ãµã€ããšæ¯èŒããŠã©ãã§ããïŒ
- Bootstrap v3.2.0-1,900æªæºã®ã»ã¬ã¯ã¿ãŒ
- Twitter-8,900æªæºã®ã»ã¬ã¯ã¿ãŒ
- NY Times-2,100æªæºã®ã»ã¬ã¯ã¿ãŒ
- SoundCloud-1,100ã»ã¬ã¯ã¿ãŒã®ã¿ïŒç·šéïŒä»¥å7,400ã«ã€ããŠè©±ããŸããããå€ãSoundCloudã§ããïŒ
ãã®ããŒã¿ã¯ãcssstats.comã䜿çšããŠåéãããŸããã ããã¯ãç§ãå«ãã»ãšãã©ã®äººãéåžžèŠãªãè§åºŠããCSSãèŠãå°ããªããŒã«ã§ãã GitHubã«ã¯ãç¬èªã®ç®çã§äœ¿çšããã°ã©ãããããŸãã
ã¹ããã±ãããä»ããæ¥ç¶
GitHubã§ã¯ãCSSãšJavaScriptã¯Sprocketsã䜿çšããŠæå¹åãããrequireãããŸãã äž¡æ¹ã®CSSããã±ãŒãžãapp / asset / stylesheetså
ã®åå¥ã®ãã£ã¬ã¯ããªã«ä¿åããŸãã ããã¯ã©ã®ããã«èŠãããã§ãïŒ
/ *
=ãã©ã€ããŒ/ããŒã¹ã³ãŒã/ããŒãã©ã€ãºãå¿
èŠ
=ãã©ã€ããŒ/ããŒã¹ã³ãŒã/ããŒã¹ãå¿
èŠ
=ãã©ã€ããŒ/ããŒã¹ã³ãŒã/ãã©ãŒã ãå¿
èŠ
=ãã©ã€ããŒ/ããŒã¹ã³ãŒã/ã¿ã€ããå¿
èŠ
=ãã©ã€ããŒ/ããŒã¹ã³ãŒã/ãŠãŒãã£ãªãã£ãå¿
èŠ
= require_directory ./shared
= require_directory ./_plugins
= require_directory ./graphs
=ãã©ã€ããŒãŠãŒã¶ãŒã³ã³ãã³ã/ã³ã³ããŒãã³ã/ããŒã¯ããŠã³ãå¿
èŠ
=ãã©ã€ããŒãŠãŒã¶ãŒã³ã³ãã³ã/ã³ã³ããŒãã³ã/æ§æ-é¡æãå¿
èŠ
=ãã©ã€ããŒ/ã³ã³ããŒãã³ã/ãã¿ã³ãå¿
èŠ
=ãã©ã€ããŒ/ã³ã³ããŒãã³ã/ããã²ãŒã·ã§ã³ãå¿
èŠ
=ãã©ã€ããŒ/ã³ã³ããŒãã³ã/åäœãå¿
èŠ
=ãã©ã€ããŒ/ã³ã³ããŒãã³ã/ã¢ã©ãŒããå¿
èŠ
=ãã©ã€ããŒ/ã³ã³ããŒãã³ã/ããŒã«ããããå¿
èŠ
=ãã©ã€ããŒ/ã³ã³ããŒãã³ã/ã«ãŠã³ã¿ãŒãå¿
èŠ
=ãã©ã€ããŒéžæã¡ãã¥ãŒãå¿
èŠ
=ãªã¯ãã£ã³ã³ãå¿
èŠ
= require_directoryã
* /
äŸåé¢ä¿ããã©ã°ã€ã³ãïŒPrimerã¯å
éšãã¬ãŒã ã¯ãŒã¯ã§ãïŒãscssãã£ã¬ã¯ããªãããã¹ãŠã®ãã¡ã€ã«ãããŠã³ããŒãããŸãã æ¥ç¶é åºã¯ã¹ããã±ããã«ãã£ãŠæ±ºå®ãããŸãïŒã¢ã«ãã¡ãããé ã®ããã§ãïŒã ïŒrequire_directoryãèšè¿°ããã ãã§ïŒã¹ã¿ã€ã«ã·ãŒããç°¡åã«æ¥ç¶ã§ããŸãã ãããããã®ã¢ãããŒãã«ã¯æ¬ ç¹ããããŸãã
ã¹ã¿ã€ã«ãé©çšããæ¹æ³ã¯éèŠã§ãã ã¹ããã±ããã®äœ¿çšã«ãããç¹å®ã®åé¡ãçºçããå ŽåããããŸãã ããã¯ããã€ã§ãæ°ãããã¡ã€ã«ãããã±ãŒãžã«è¿œå ã§ããããã§ãã ãã¡ã€ã«åã«ãã£ãŠã¯ãã³ã³ãã€ã«æžã¿CSSã®ããŸããŸãªå Žæã«æ°ããã¹ã¿ã€ã«ã衚瀺ãããå ŽåããããŸãã
ããã«ãSprocketã䜿çšãããšãSCSSãã¡ã€ã«å
ã®ã°ããŒãã«å€æ°ãäžçŽç©ã«å³åº§ã«èªåçã«ã¢ã¯ã»ã¹ããããšã¯ã§ããŸããã ã€ãŸããå€æ°ãŸãã¯äžçŽç©ãåç
§ããåãã¡ã€ã«ã®å
é ã§æ瀺çã«ã€ã³ããŒãããå¿
èŠããããŸãã
æ§èœ
ãµã€ããšAPIã®åäœãç£èŠããããã®èšå€§ãªæ°ã®ã°ã©ãããããŸãã å«ããŠãããã³ããšã³ãã§ããã€ãã®èå³æ·±ãçµ±èšã远跡ããŸãã ããšãã°ãéå»3ãæã®2ã€ã®CSSããã±ãŒãžã®ãµã€ãºïŒ
ãŸããããŒãžããšã®ã»ã¬ã¯ã¿ãŒã®æ°ã远跡ããŸãã ã¿ã°ããšã«ã»ã¬ã¯ã¿ã®æ°ãæžãããšãã課é¡ã«ãŸã çŽé¢ããŠããŸãã
CSSãå®æçã«æŽæ°ããæ¯æ¥äœåºŠãæŽæ°ããŠãããããããªã倧ããªãã¡ã€ã«ã®ãã£ãã·ã¥ãåžžã«ãªã»ããããå¿
èŠããããŸãã ãããŸã§ã®ãšããããããã®ãã¡ã€ã«ã®ãµã€ãºã®æé©åãšãã£ãã·ã¥ã®ãã³ãã®å¶éã«ã€ããŠã¯ããŸãé²æ©ããŠããŸãããããã§ã«çå£ã«èãå§ããŠããŸãã ãã£ãã«å€æŽãããªãã¡ã€ã³ããã±ãŒãžãšããã€ããŒã§æ£çŽã«å€æŽå¯èœãªã¡ã€ã³ããã±ãŒãžããããšäŸ¿å©ã§ãã
ç§ãTwitterã§åããŠãããšãã2ã€ã®ããã±ãŒãžïŒããããŸã åœãŠã¯ãŸããã©ããããããŸããïŒããã©ã€ããªãŒãšã»ã«ã³ããªãŒããããŸããã åºæ¬çã«ãæåã®ãã€ãŒããã§ããã ãæ©ã衚瀺ããããã«å¿
èŠãªãã¹ãŠã®ã¹ã¿ã€ã«ã説æãããŸããã ä»ã®ãã¹ãŠã¯è¿œå ã§ä¿åãããŸããã GitHubããã¹ãŠã®ããšãè¿
éã«æããŠããããšãèãããšãããã¯ãŸãã«è¿ãå°æ¥ã«æ€èšããäºå®ã®ããšã§ãã çŸåšããã¡ã€ã«å
±æã¯ã©ã³ãã ã§ãã
ååãšããŠãã»ã¬ã¯ã¿ãŒã®ããã©ãŒãã³ã¹ã¯æ±ããŸããã ç§ãã¡ã¯æªãç¿æ
£ã«ã€ããŠç¥ã£ãŠããŸã-å€ãã®ãã¹ããidãšèŠçŽ ã«ããã»ã¬ã¯ã¿ãŒã®äœ¿çšãªã©ãããããç§ãã¡ã¯ãããå°ãæé©åããããšã¯ããŠããŸããã 1ã€ã®äŸå€ã¯ãå·®åããŒãžã§ãã å·®åã®ã¬ã³ããªã³ã°ã«å¿
èŠãªåºç¯ãªããŒã¯ã¢ããã®ããã[class ^ = "octicon"]ãªã©ã®å±æ§ã»ã¬ã¯ã¿ãŒã¯é¿ããŸãã ããŸãã«ãé »ç¹ã«äœ¿çšãããšããã®ãããªå±æ§ã»ã¬ã¯ã¿ãŒã¯ãã©ãŠã¶ãŒãé
眮ã§ããŸãïŒå®éã«äœ¿çšããŸããïŒã
奜å¥å¿Forçãªäººã®ããã«ãGitHubã®éçºè
ã§ããJon Rohanã¯ããããã®åé¡ã«å¯ŸåŠããGitHubã®CSSããã©ãŒãã³ã¹ã«é¢ããåªããã¬ããŒããäœæããŸããã
ããã¥ã¡ã³ã
ããã¥ã¡ã³ãã«é¢ããŠèšãã°ãç§ãã¡ã¯ããã«ã€ããŠçŽ æŽãããä»äºãããŸãããããŸã æ¹åã«åãçµãã§ããŸãã CSSã¬ã€ããšCSSãèšè¿°ããããã®ãã¹ãŠã®åºæ¬çãªã«ãŒã«ãå
¬éããŸããã ãŸããã»ãšãã©ã®ã³ã³ããŒãã³ãã®äŸãæ²èŒããŸããã ã¹ã¿ã€ã«ã¬ã€ããžã§ãã¬ãŒã¿ãŒã§ããKSSã䜿çšããŠæ§ç¯ãããŠããŸãã
ç§ãã¡ã®ããã¥ã¡ã³ãã¯å®ç§ã§ã¯ãããŸãããã人ã
ãæããã®ãèŠã€ããŠäœ¿ãã®ã«åœ¹ç«ã¡ãŸãã ããã«ãããã¯ãéçºããã»ã¹ãžã®æ³šå
¥ãå éããããã«ç§ãã¡ãã©ã®ããã«åãããæ°äººã«ç€ºãçŽ æŽãããæ¹æ³ã§ãïŒçŽ2幎åã«ç§ãããã§ãã£ãããã«ïŒã
ãã©ã€ããŒ
以åPrimerã«èšåããŸããããç¥ããªã人ã«ãšã£ãŠã¯ãPrimerã¯ãããªãã¯ãã¬ãŒã ã¯ãŒã¯ãšå
éšãããžã§ã¯ãã®äž¡æ¹ã§äœ¿çšãããã¹ã¿ã€ã«ãšã³ã³ããŒãã³ããå«ãå
éšãã¬ãŒã ã¯ãŒã¯ã§ãã 以äžãå«ãŸããŸãã
- ããŒãã©ã€ãº
- ããã¯ã¹ãµã€ãºãã¿ã€ãã°ã©ãã£ããªã³ã¯ãªã©ã®ã°ããŒãã«ã¹ã¿ã€ã«
- ããã²ãŒã·ã§ã³é
ç®
- ãã©ãŒã
- ããã
- ã«ã¹ã¿ã éžæèŠçŽ
GitHub.comãGistãããã³ããã€ãã®å
éšã¢ããªã±ãŒã·ã§ã³ã§äœ¿çšããŠããŸãã ååãšããŠãå¥ã®ã¢ããªã±ãŒã·ã§ã³ã§äœãã䜿çšã§ããå Žåã¯ããããPrimerã«å«ããŸãã ã»ãšãã©ã®ãã©ã€ããŒã³ã³ããŒãã³ãã¯ãã¬ã€ãã«èšèŒãããŠããŸãã
ãªãã¡ã¯ã¿ãªã³ã°
ãããžã§ã¯ãã«ã¯äžå®éã®ã¬ã¬ã·ãŒã³ãŒãããããCSSãå«ãŸããŠããŸãã å³æ ŒãªããŒãžã§ã³ç®¡çèŠåãæã€ãªãã©ãããžã§ã¯ããšã¯ç°ãªããç§ãã¡ã¯ãã°ãã°ãããæã¡ãŸãã 次ã®2ã€ã®å Žåã«ãã³ãŒãã®äžéšãåé€ããããšã«ããŸããã
- æäœæ¥ã§äŒŒãå ŽæãèŠã€ããŸãããç°ãªãHTMLãŸãã¯CSSã³ãŒãã§èšè¿°ãããŠããŸãã ãã®å ŽåãåçŽã«çµã¿åãããŸãã
- ãã¥ãŒã«ãªãCSSã³ãŒãã®ã¯ã©ã¹ãæ¢ãã¹ã¯ãªãããå®è¡ããŸãã ïŒãã¹ãã«å«ããããšã§ããã®ããã»ã¹ãèªååããŸããïŒã
GitHubäžã®CSSãªãã¡ã¯ã¿ãªã³ã°ããã»ã¹èªäœã¯ãŠããŒã¯ã§ã¯ãããŸããã äžè¯ã³ãŒããèŠã€ããŠåé€ããã§ããã ãæ©ãå±éããŸãã ããŒã ã¡ã³ããŒã¯èª°ã§ãã³ãŒããåé€ã§ããŸãã å€ãã®ã¯ãŒã«ãªéçºè
ãããŒã ã«åå ããŠããŸãããåé€ã§ãããã®ãšããã§ãªããã®ãç£èŠãããªã¿ã¯ãããŸãã
ã質åã¯ïŒ
ãã®èšäºãBootstrapãGitHubããŸãã¯ãã®ä»ã«ã€ããŠè³ªåãããå Žåã¯
ã TwitterãŸãã¯
ç§ã®ãªããžããªã«ãã£ãŒãããã¯ãäŸé ŒããŠãã ããã