├── .gitignore ├── 404.md ├── Gemfile ├── README.md ├── _chapters ├── 01-introduction.md ├── 02-semantics.md ├── 03-reuse.md ├── 04-ids.md ├── 05-conventions.md ├── 06-modules.md ├── 07-state.md ├── 08-modifiers.md ├── 09-versioning.md ├── 10-javascript.md └── 11-faqs.md ├── _config.yml ├── _includes ├── chapterList.html ├── chapterNavigation.html ├── favicon.html ├── footer.html ├── head.html ├── header.html ├── navigation.html └── share.html ├── _layouts ├── chapter.html ├── chapters.html ├── default.html └── other.md ├── _pages └── chapters.md ├── android-chrome-144x144.png ├── android-chrome-192x192.png ├── android-chrome-36x36.png ├── android-chrome-48x48.png ├── android-chrome-72x72.png ├── android-chrome-96x96.png ├── apple-touch-icon-114x114.png ├── apple-touch-icon-120x120.png ├── apple-touch-icon-144x144.png ├── apple-touch-icon-152x152.png ├── apple-touch-icon-180x180.png ├── apple-touch-icon-57x57.png ├── apple-touch-icon-60x60.png ├── apple-touch-icon-72x72.png ├── apple-touch-icon-76x76.png ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── assets ├── css │ └── main.css └── img │ ├── card1.png │ ├── logo.png │ └── logo_small.png ├── atom.xml ├── browserconfig.xml ├── deploy.sh ├── favicon-128.png ├── favicon-16x16.png ├── favicon-196x196.png ├── favicon-32x32.png ├── favicon-96x96.png ├── favicon.ico ├── index.md ├── manifest.json ├── mstile-144x144.png ├── mstile-150x150.png ├── mstile-310x150.png ├── mstile-310x310.png ├── mstile-70x70.png ├── safari-pinned-tab.svg └── sitemap.xml /.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | **/.DS_Store 3 | *.sublime-project 4 | *.sublime-workspace 5 | Gemfile.lock -------------------------------------------------------------------------------- /404.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: other 3 | title: We can't find the page you asked for. Sorry. 4 | --- 5 | 6 | This site is really small, so try visiting the [homepage]({{ site.url }}/index.html). 7 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'github-pages' -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [MaintainableCSS 中文版](https://github.com/owenyang0/maintainablecss-cn) 2 | 3 | MaintainableCSS 是一种哲学,教你如何编写模块化,可扩展性,可维护性的CSS。编写 CSS 不用再去过分担心原有的样式会受你的影响。 4 | 5 | > 在线地址:http://owenyang0.github.io/maintainablecss-cn/ 6 | > 英文原版:http://maintainablecss.com/ 7 | 8 | ### 本地启动 9 | ```bash 10 | bundle install 11 | jeklly build 12 | jekyll serve --baseurl '/maintainablecss-cn' 13 | ``` 14 | 15 | ### 贡献者 16 | * [Owen Yang](https://github.com/owenyang0) 17 | * [Bang Wu](https://github.com/bangwu) 18 | 19 | -------------------------------------------------------------------------------- /_chapters/01-introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: chapter 3 | title: 介绍 4 | section: Preface 5 | permalink: /chapters/introduction/ 6 | description: 介绍MaintainableCSS, 用一种模块化和可扩展的方式来编写CSS. 7 | --- 8 | 9 | *MaintainableCSS* 是一种编写模块化、可扩展和易维护的CSS的架构。 10 | 11 | 在实际情况下,这意味着,作为一个开发者,当我想创建一个新的功能或者修改已有的功能的时候,我不需要担心会使原来的代码变的更糟。 12 | 13 | ## 什么都不需要下载 14 | 15 | *MaintainableCSS* 是不需要下载的。这只是一套帮助你构建大规模或者小规模网站的原则、指南和约定。 16 | 17 | ## 可维护的意义是什么? 18 | 19 | 有一份可维护的代码意味着当你编辑一个模块的样式的时候不需要担心意外的改变的其他模块的代码。我清楚的知道我写出的代码是经过封装的。 20 | 21 | ## 可维护的意义是什么? 22 | 23 | 这意味着, 当CSS代码库的大小增长的时候, 维护这些代码不会有任何困难. 如果你曾经继承了一个大的CSS代码库并且害怕去编辑这些已有的样式,你就会深有感触了。 24 | 25 | ## 模块化的意义是什么? 26 | 27 | 模块是一个特殊的、独立的单元,可以与其他的模块进行组合,以便形成更加复杂的单元。例如在一个客厅,你可以把电视、沙发和墙分别看成模块,这些组合在一起就是一个可以使用的房间。 28 | 29 | 如果你带走其中一个单元,其他的任然能够工作的很好,没有电视你也能坐在沙发上,在一个网站上,页眉、页脚、产品列表和文章,这些都可以考虑为一个模块。 30 | 31 | ## 这适合谁? 32 | 33 | 如果你曾经经历过维护CSS的痛苦,这本书可以帮助你避免常见的问题。无论的你的组是1个人或者是100个人,你都能在这本书上找到有用的建议。如果你的网站正在发展,你更加需要这本书。 34 | 35 | ## 这学起来难吗? 36 | 37 | 我想说的是这很容易学。你可以在20分钟内读完这本书并且在几分钟内使用这些规则。如果你发现了任何错误请及时通知我。 38 | -------------------------------------------------------------------------------- /_chapters/02-semantics.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: chapter 3 | title: 语义化(Semantics) 4 | section: Background 5 | permalink: /chapters/semantics/ 6 | description: Why naming something based on what it is, instead of how it looks or behaves is a cornerstone of writing well architected and maintainable CSS code. 7 | --- 8 | 9 | **概述:** 基于这 *是* 什么命名,而不是基于它 *像* 什么或 *能做* 什么命名。 10 | 11 | ## 长版本解释 12 | 13 | 语义化(semantic)的 HTML 不仅仅关乎我们所使用的元素——你当然知道一个链接应该使用 `` 标签,表格数据应该使用 `