diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf17fe5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +# Ignore bundler config +/.bundle + +# Ignore the bin directory +/bin + +# Ignore the build directory +/build + +# Ignore Sass' cache +/.sass-cache + +# I loath thee, .DS_Store +.DS_Store + +# Legacynick +.ruby-version +.ruby-gemset diff --git a/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29..0000000 diff --git a/Gemfile b/Gemfile new file mode 100755 index 0000000..266caa5 --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +# If you have OpenSSL installed, we recommend updating +# the following line to use "https" +source 'http://rubygems.org' + +gem 'redcarpet' +gem 'rake' + +gem 'middleman', '~>3.0' +gem 'middleman-livereload' +gem 'middleman-minify-html' +gem 'middleman-syntax' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100755 index 0000000..45486a7 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,151 @@ +GEM + remote: http://rubygems.org/ + specs: + activesupport (4.2.6) + i18n (~> 0.7) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + capybara (2.4.4) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) + chunky_png (1.3.5) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.10.0) + compass (1.0.3) + chunky_png (~> 1.2) + compass-core (~> 1.0.2) + compass-import-once (~> 1.0.5) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + sass (>= 3.3.13, < 3.5) + compass-core (1.0.3) + multi_json (~> 1.0) + sass (>= 3.3.0, < 3.5) + compass-import-once (1.0.5) + sass (>= 3.2, < 3.5) + em-websocket (0.5.1) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0.6.0) + erubis (2.7.0) + eventmachine (1.2.0.1) + execjs (2.7.0) + ffi (1.9.10) + haml (4.0.7) + tilt + hike (1.2.3) + hooks (0.4.1) + uber (~> 0.0.14) + htmlcompressor (0.2.0) + http_parser.rb (0.6.0) + i18n (0.7.0) + json (1.8.3) + kramdown (1.11.1) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + middleman (3.4.1) + coffee-script (~> 2.2) + compass (>= 1.0.0, < 2.0.0) + compass-import-once (= 1.0.5) + execjs (~> 2.0) + haml (>= 4.0.5) + kramdown (~> 1.2) + middleman-core (= 3.4.1) + middleman-sprockets (>= 3.1.2) + sass (>= 3.4.0, < 4.0) + uglifier (~> 2.5) + middleman-core (3.4.1) + activesupport (~> 4.1) + bundler (~> 1.1) + capybara (~> 2.4.4) + erubis + hooks (~> 0.3) + i18n (~> 0.7.0) + listen (~> 3.0.3) + padrino-helpers (~> 0.12.3) + rack (>= 1.4.5, < 2.0) + thor (>= 0.15.2, < 2.0) + tilt (~> 1.4.1, < 2.0) + middleman-livereload (3.4.6) + em-websocket (~> 0.5.1) + middleman-core (>= 3.3) + rack-livereload (~> 0.3.15) + middleman-minify-html (3.4.1) + htmlcompressor (~> 0.2.0) + middleman-core (>= 3.2) + middleman-sprockets (3.4.2) + middleman-core (>= 3.3) + sprockets (~> 2.12.1) + sprockets-helpers (~> 1.1.0) + sprockets-sass (~> 1.3.0) + middleman-syntax (2.1.0) + middleman-core (>= 3.2) + rouge (~> 1.0) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_portile2 (2.0.0) + minitest (5.9.0) + multi_json (1.12.1) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) + padrino-helpers (0.12.7) + i18n (~> 0.6, >= 0.6.7) + padrino-support (= 0.12.7) + tilt (~> 1.4.1) + padrino-support (0.12.7) + activesupport (>= 3.1) + rack (1.6.4) + rack-livereload (0.3.16) + rack + rack-test (0.6.3) + rack (>= 1.0) + rake (10.4.2) + rb-fsevent (0.9.7) + rb-inotify (0.9.7) + ffi (>= 0.5.0) + redcarpet (3.3.4) + rouge (1.10.1) + sass (3.4.22) + sprockets (2.12.4) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-helpers (1.1.0) + sprockets (~> 2.0) + sprockets-sass (1.3.1) + sprockets (~> 2.0) + tilt (~> 1.1) + thor (0.19.1) + thread_safe (0.3.5) + tilt (1.4.1) + tzinfo (1.2.2) + thread_safe (~> 0.1) + uber (0.0.15) + uglifier (2.7.2) + execjs (>= 0.3.0) + json (>= 1.8.0) + xpath (2.0.0) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + middleman (~> 3.0) + middleman-livereload + middleman-minify-html + middleman-syntax + rake + redcarpet + +BUNDLED WITH + 1.12.4 diff --git a/README.md b/README.md new file mode 100644 index 0000000..44459f4 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +## Setup + +- `gem install bundler` +- `bundle` +- `middleman s` (`./bin/middleman s`, if using rbenv/binstubs) + +## Build + +- Run `middleman build` (or `./bin/middleman build`) *before* pushing up your changes + +## Deploy + +- Run `rake deploy`, which will build and push the static files to `master`. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..4972b06 --- /dev/null +++ b/Rakefile @@ -0,0 +1,27 @@ +desc 'Generate flat files with Middleman' +task :generate do + puts '## Generating site with Middleman' + system 'rm -rf build' + system 'bundle exec middleman build --clean' + system 'cp CNAME build/CNAME' + cd 'build' do + system 'touch .nojekyll' + system 'git init' + system 'git remote add origin git@github.com:mvcss/mvcss.github.com.git' + end +end + +desc 'Push the build to GitHub' +task :push do + puts '## Deploying build to GitHub Pages' + cd 'build' do + system 'git add .' + system 'git add -u' + system "git commit -m \'Site updated at #{Time.now.utc}\'" + system 'git push origin master --force' + end +end + +desc 'Generate flat files and deploy to GitHub Pages' +task :deploy => [:generate, :push] do +end diff --git a/about/index.html b/about/index.html deleted file mode 100644 index b81488c..0000000 --- a/about/index.html +++ /dev/null @@ -1,23 +0,0 @@ - About / MVCSS
Toggle

About

In the beginning, MVCSS was created by Nick Walsh and Drew Barontini as a means of formalizing their individual CSS methods. With version one of MVCSS, the ideas of contextual changes throughout a site were tied closely to the MVC, or Model View Controller, pattern, where higher-level body classes were applied for the Controller/View of the given page. This worked at first, but quickly grew unwiedly, and began to feel like an anti-pattern for how we should be writing our CSS. The change was made in version two, and, through the preceding versions, iteratively evolved MVCSS into a more mature framework.

The Team

Now, the front-end teams using and contributing to MVCSS are split across two companies, Envy and Code School. Their shared experiences working across a vast array of large-scale client and product-based applications have helped to shape MVCSS into what it is today.

Envy

Code School

\ No newline at end of file diff --git a/assets/javascripts/application.js b/assets/javascripts/application.js deleted file mode 100644 index eb41573..0000000 --- a/assets/javascripts/application.js +++ /dev/null @@ -1 +0,0 @@ -(function(){this.Leo={},this.Leo.Pager={},Leo.headingLinks=function(e){return e.els.each(function(){var e,n;return e=$(this),n=Leo.slugify(e.text()),e.attr("id",n),e.prepend("#")})},Leo.readTime=function(e){var n;return n=Math.ceil(e.text.split(" ").length/e.wordsPerMinute),e.element.append(""+n+" minute read")},Leo.Pager=function(){var e,n,t,s,o,i,u,r;return o=0,i=[],r={next:39,prev:37},s=function(e){return o=e,n(),u(),console.log(o)},n=function(){return i.push("/"),i.push("/styleguide/"),i.push("/styleguide/basics/"),i.push("/styleguide/numbers-game/"),i.push("/styleguide/comments/"),i.push("/styleguide/naming/"),i.push("/manifest/"),i.push("/foundation/"),i.push("/foundation/reset/"),i.push("/foundation/helpers/"),i.push("/foundation/config/"),i.push("/foundation/base/"),i.push("/foundation/tools/"),i.push("/components/"),i.push("/structures/"),i.push("/vendor/"),i.push("/about/"),i.push("/resources/")},u=function(){return $(document).on("keydown",function(n){switch(e(n)){case r.next:return t("next");case r.prev:return t("prev")}})},e=function(e){var n;return e=e||window.event,n=e.keyCode||e.which},t=function(e){switch(e){case"next":if(o!==i.length-1)return window.location=i[o+1];break;case"prev":if(0!==o)return window.location=i[o-1]}},{init:s}}(),Leo.slugify=function(e){return e.toLowerCase().replace(/\s+/g,"-").replace(/[^\w\-]+/g,"").replace(/\-\-+/g,"-").replace(/^-+/,"").replace(/-+$/,"")},jQuery(function(e){return Leo.headingLinks({els:e("h2, h3, h4, h5, h6")}),Leo.Pager.init(e("body").data("id")),e(".toggle").on("click",function(n){return n.preventDefault(),e(this).toggleClass("is-active"),e("body").toggleClass("is-sidebar-open"),e(".sidebar").toggleClass("is-open")}),e(document).on("keyup",function(n){switch(n.which){case 83:return e(".toggle").toggleClass("is-active"),e("body").toggleClass("is-sidebar-open"),e(".sidebar").toggleClass("is-open")}})})}).call(this); \ No newline at end of file diff --git a/assets/stylesheets/application.css b/assets/stylesheets/application.css deleted file mode 100644 index 86351ab..0000000 --- a/assets/stylesheets/application.css +++ /dev/null @@ -1 +0,0 @@ -/*! normalize.css v3.0.0 | MIT License | git.io/normalize */@import url("http://fonts.googleapis.com/css?family=Roboto+Slab:400,300,700");@import url("http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,700");html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}html{background:#ecf0f1;color:#444;font-family:"Roboto Slab", serif;font-size:16px;line-height:1.6}body{font-size:100%}body.is-sidebar-open{overflow-y:hidden;position:fixed}@media screen and (min-width: 50em){body.is-sidebar-open{position:static}}.content{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0);-webkit-transition:-webkit-transform 0.3s ease-in-out;transition:-webkit-transform 0.3s ease-in-out;transition:-moz-transform 0.3s ease-in-out;transition:-ms-transform 0.3s ease-in-out;transition:transform 0.3s ease-in-out;margin-bottom:5em;padding-top:0.3125em}.is-sidebar-open .content{-webkit-transform:translateX(17.1875em);-ms-transform:translateX(17.1875em);transform:translateX(17.1875em)}@media screen and (min-width: 50em){.is-sidebar-open .content{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}@media screen and (min-width: 50em){.content{margin-left:17.1875em}}ul,ol,p{margin-bottom:1.25em;margin-top:0}ul,ol{padding-left:2.5em}li{margin-bottom:0.625em;margin-top:0}li>ul,li>ol{margin-top:0.625em}blockquote{color:#b5b5c0;font-style:italic;margin-bottom:1.25em;margin-left:1.25em;margin-top:0}pre,code{font-family:Courier, monospace}pre{margin-bottom:1.25em}h1,.h1,h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6{font-family:"Roboto Slab", serif;font-weight:bold;line-height:1.2;margin-bottom:0.625em;margin-top:1.25em}@media screen and (min-width: 50em){h1,.h1,h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6{margin-top:0}}@media screen and (min-width: 68.75em){h1,.h1,h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6{margin-top:1.25em}}h2,.h2,h3,.h3,h4,.h4,h5,.h5,h6,.h6{position:relative}@media screen and (min-width: 68.75em){h2:hover>a,.h2:hover>a,h3:hover>a,.h3:hover>a,h4:hover>a,.h4:hover>a,h5:hover>a,.h5:hover>a,h6:hover>a,.h6:hover>a{display:block}}h1,.h1{font-size:200%}h1>b,.h1>b{color:#b5b5c0;display:block;font-size:50%;font-weight:normal;margin-top:0.3125em}h2,.h2{border-bottom:2px solid #ccd4d5;font-size:150%;margin-bottom:1.25em;margin-top:2.5em;padding-bottom:0.3125em}h3,.h3{font-size:125%}h4,.h4{font-size:110%}h5,.h5{font-size:115%}h6,.h6{font-size:105%}a{border-bottom:2px solid #ccd4d5;color:#4e4e5b;text-decoration:none;transition:all 0.3s ease-in-out}a:hover,a:focus{border-bottom-color:#4e4e5b;color:#4e4e5b}img{height:auto;max-width:100%}.bucket--flag{display:table}.bucket--flag .bucket-content{vertical-align:middle}.bucket-content{display:table-cell;width:10000px}.bucket-media{float:left;margin-right:1.25em}.bucket-media>img{display:block;max-width:none}.card,pre,code,img{background:#fff;border-radius:3px;box-shadow:0 2px 0 rgba(51,51,51,0.25);padding:1.25em;position:relative}.card--thin,code{box-shadow:none;padding:0.25em 0.5em}.cell{margin-left:auto;margin-right:auto;max-width:46.875em;position:relative;max-width:64.0625em}.row{overflow:hidden;padding:0 1.25em}.row--a{background:#fff}@media screen and (min-width: 50em){.well{margin-bottom:1.25em;margin-top:1.25em}}.well--l{margin-bottom:2.5em;margin-top:2.5em}.anchor{border:0;display:none;bottom:0;left:-1.25em;padding-left:1.25em;padding-right:1.25em;margin-left:-1.25em;position:absolute;top:0}.header{background:#363640;height:auto;padding:1.25em;position:relative;text-align:center}.header-logo{background:none;border-radius:0;box-shadow:none;display:block;padding:0;position:static}.header-title{margin:0;text-transform:uppercase}.header-title>a{border:0;color:#fff}.header-title>a:hover,.header-title>a:focus{color:#b5b5c0}.header-version{color:#b5b5c0;font-weight:300;margin-bottom:0}.pager{border-top:2px solid #ccd4d5;margin:0;padding:0;margin-top:5em;padding-top:1.25em;text-align:center}.pager-item{display:inline;list-style-type:none;margin-right:1.25em}.pager-item:last-child{margin-right:0}.sidebar{-webkit-transform:translateX(-100%);-ms-transform:translateX(-100%);transform:translateX(-100%);-webkit-transition:-webkit-transform 0.3s ease-in-out;transition:-webkit-transform 0.3s ease-in-out;transition:-moz-transform 0.3s ease-in-out;transition:-ms-transform 0.3s ease-in-out;transition:transform 0.3s ease-in-out;background:#4e4e5b;bottom:0;left:0;overflow:scroll;position:fixed;top:0;width:17.1875em;z-index:10}@media screen and (min-width: 50em){.sidebar{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}}.sidebar.is-open{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.sidebar-btn{background:#666676;border-color:#363640;border-radius:3px;color:#fff;display:block;line-height:2.5;margin:0.625em;padding:0 1.25em;text-align:center}.sidebar-btn:hover,.sidebar-btn:focus{background:#717184;border-color:#363640;color:#fff}.sidebar-label{border-bottom:2px solid #363640;color:#ecf0f1;font-size:85%;font-weight:normal;letter-spacing:0.1em;margin:0;padding:0 1.25em 0.625em;text-transform:uppercase}.sidebar-link{border:0;color:#b5b5c0;display:block;font-family:"Roboto Slab", serif;font-size:85%;padding:0.625em 1.25em}.sidebar-link:hover,.sidebar-link:focus{background:#363640;color:#fff}.sidebar-link--sub{padding-left:2.5em}.sidebar-link.is-active{background:#ecf0f1;color:#444}.sidebar-nav-sub{background:#42424d;display:none}.sidebar-nav-sub.is-active{display:block}.toggle{border:0;height:15px;left:1.25em;position:absolute;top:1.25em;-webkit-backface-visibility:hidden;width:24px;z-index:20}@media screen and (min-width: 50em){.toggle{display:none}}@media screen and (min-width: 50em){.toggle{position:fixed}}.toggle.is-active{left:18.4375em}.toggle.is-active .toggle-icn-stack{background:none}.toggle.is-active .toggle-icn-stack::before,.toggle.is-active .toggle-icn-stack::after{-webkit-transition:all 0.3s 0.2s ease-in-out;transition:all 0.3s 0.2s ease-in-out;top:0}.toggle.is-active .toggle-icn-stack::before{-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.toggle.is-active .toggle-icn-stack::after{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.toggle-icn{border:0;display:block;height:15px;position:absolute;right:0;-webkit-backface-visibility:hidden;width:24px}.toggle-icn-stack{-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out;background:#b5b5c0;display:block;height:3px;margin-top:3px;width:24px}.toggle-icn-stack::before,.toggle-icn-stack::after{-webkit-transition:all 0.3s ease-in-out;transition:all 0.3s ease-in-out;background:#b5b5c0;content:"";display:block;height:3px;position:absolute;width:24px;z-index:0}.toggle-icn-stack::before{top:-3px}.toggle-icn-stack::after{top:9px}.hll{background-color:#ffffcc}.c{color:#999988;font-style:italic}.err{color:#a61717;background-color:#e3d2d2}.k{color:#000000;font-weight:bold}.o{color:#000000;font-weight:bold}.cm{color:#999988;font-style:italic}.cp{color:#999999;font-weight:bold;font-style:italic}.c1{color:#999988;font-style:italic}.cs{color:#999999;font-weight:bold;font-style:italic}.gd{color:#000000;background-color:#ffdddd}.ge{color:#000000;font-style:italic}.gr{color:#aa0000}.gh{color:#999999}.gi{color:#000000;background-color:#ddffdd}.go{color:#888888}.gp{color:#555555}.gs{font-weight:bold}.gu{color:#aaaaaa}.gt{color:#aa0000}.kc{color:#000000;font-weight:bold}.kd{color:#000000;font-weight:bold}.kn{color:#000000;font-weight:bold}.kp{color:#000000;font-weight:bold}.kr{color:#000000;font-weight:bold}.kt{color:#445588;font-weight:bold}.m{color:#009999}.s{color:#d01040}.na{color:#008080}.nb{color:#0086B3}.nc{color:#445588;font-weight:bold}.no{color:#008080}.nd{color:#3c5d5d;font-weight:bold}.ni{color:#800080}.ne{color:#990000;font-weight:bold}.nf{color:#990000;font-weight:bold}.nl{color:#990000;font-weight:bold}.nn{color:#555555}.nt{color:#000080}.nv{color:#008080}.ow{color:#000000;font-weight:bold}.w{color:#bbbbbb}.mf{color:#009999}.mh{color:#009999}.mi{color:#009999}.mo{color:#009999}.sb{color:#d01040}.sc{color:#d01040}.sd{color:#d01040}.s2{color:#d01040}.se{color:#d01040}.sh{color:#d01040}.si{color:#d01040}.sx{color:#d01040}.sr{color:#009926}.s1{color:#d01040}.ss{color:#990073}.bp{color:#999999}.vc{color:#008080}.vg{color:#008080}.vi{color:#008080}.il{color:#009999}.boxSizing,.card,pre,code,img,.header,.sidebar{-moz-box-sizing:border-box;box-sizing:border-box}.group::after,.bucket::after{clear:both;content:"";display:table}.debug{background-color:pink !important}.ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ir{background-color:transparent;border:0;overflow:hidden}.ir::before{content:"";display:block;width:0;height:150%}.srt{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.bch{background:#4e4e5b}.bci{background:#fff}.bcs{background:#b5b5c0}.db{display:block}.di{display:inline}.dib{display:inline-block}.dn{display:none}.maxs{margin:0.3125em}.mas{margin:0.625em}.mam{margin:1.25em}.mal{margin:2.5em}.maxl{margin:5em}.mbf{margin-bottom:0}.mbxs{margin-bottom:0.3125em}.mbs{margin-bottom:0.625em}.mbm{margin-bottom:1.25em}.mbl{margin-bottom:2.5em}.mbxl{margin-bottom:5em}.mhc{margin-left:auto;margin-right:auto}.mlf{margin-left:0}.mlxs{margin-left:0.3125em}.mls{margin-left:0.625em}.mlm{margin-left:1.25em}.mll{margin-left:2.5em}.mrf{margin-right:0}.mrxs{margin-right:0.3125em}.mrs{margin-right:0.625em}.mrm{margin-right:1.25em}.mrl{margin-right:2.5em}.mtf{margin-top:0}.mtxs{margin-top:0.3125em}.mts{margin-top:0.625em}.mtm{margin-top:1.25em}.mtl{margin-top:2.5em}.mtxl{margin-top:5em}.paxs{padding:0.3125em}.pas{padding:0.625em}.pam{padding:1.25em}.pal{padding:2.5em}.paxl{padding:5em}.pbf{padding-bottom:0}.pbxs{padding-bottom:0.3125em}.pbs{padding-bottom:0.625em}.pbm{padding-bottom:1.25em}.pbl{padding-bottom:2.5em}.pbxl{padding-bottom:5em}.plf{padding-left:0}.plxs{padding-left:0.3125em}.pls{padding-left:0.625em}.plm{padding-left:1.25em}.pll{padding-left:2.5em}.prf{padding-right:0}.prxs{padding-right:0.3125em}.prs{padding-right:0.625em}.prm{padding-right:1.25em}.prl{padding-right:2.5em}.ptf{padding-top:0}.ptxs{padding-top:0.3125em}.pts{padding-top:0.625em}.ptm{padding-top:1.25em}.ptl{padding-top:2.5em}.ptxl{padding-top:5em}.fl{float:left}.fr{float:right}.poa{position:absolute}.pof{position:fixed}.por{position:relative}.pos{position:static}.ra{border-radius:50%}.ram{border-radius:3px}.ran{border-radius:0}.tac{text-align:center}.tch{color:#4e4e5b}.tci{color:#fff}.tcs{color:#b5b5c0}.tct{color:#444}.tfb{font-family:"Roboto Slab", serif}.tfh{font-family:"Roboto Slab", serif}.tsxs{font-size:60%}.tss{font-size:75%}.tsm{font-size:90%}.tsl{font-size:115%}.tsxl{font-size:150%}.tsi{font-style:italic}.ttu{text-transform:uppercase}.twn{font-weight:normal}.twb{font-weight:bold} \ No newline at end of file diff --git a/components/index.html b/components/index.html deleted file mode 100644 index f80ef64..0000000 --- a/components/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Components / MVCSS
Toggle

Components

The beginnings of a recognizable user interface live in the Components directory. These are abstract, reasonably portable modules that can be swapped in and out of different projects with relative ease.

Some Components, like g (grid) and card, are used for layout and containers, and can encompass many other modules.

<div class="g">
  <div class="g-box g-b--1of2">
    <div class="card">
      <!-- Content -->
    </div>
  </div>
  <div class="g-b g-b--1of2">
    <div class="card">
      <!-- Content -->
    </div>
  </div>
</div>

Note: We shorten grid classes to g and grid-box classes to g-b. Since we write these grid classes so frequently, we want them to be as concise as possible. However, feel free to use the full words, if that’s more comfortable for you.

Other Components, like thumb, affect only a single element, and can resemble Tools at first glance. In these situations, both the Component and Tool have a single responsibility. The Component, however, may be declared alongside its modifier classes, while the Tool applies more definitive styles.

<div class="bucket">
  <div class="bucket-media">
    <img class="thumb thumb--m" src="avatar-nick.jpg" alt="Nick Walsh">
  </div>
  <div class="bucket-content">
    <p>Nick Walsh</p>
  </div>
</div>

Characteristics

When determing whether a module is a Component or Structure, we find it helpful to ask ourselves the following questions:

  • Does this module limit its scope as much as possible?
  • Is this module independent of pre-existing Components?
  • Is this module abstract enough to use in other projects without making significant changes?

If you answer “no” to any of these questions, the module in question is more than likely a Structure.

\ No newline at end of file diff --git a/config.rb b/config.rb new file mode 100755 index 0000000..a0e293a --- /dev/null +++ b/config.rb @@ -0,0 +1,63 @@ +activate :automatic_image_sizes +activate :directory_indexes +activate :livereload +activate :minify_html +activate :syntax + +set :markdown_engine, :redcarpet +set :markdown, :fenced_code_blocks => true, :smartypants => true +set :relative_links, true + +# Methods defined in the helpers block are available in templates +helpers do + def get_page_priority(page) + unless page.nested? + data.priority.index(page.title) || data.priority.length + else + data.priority.index("#{ page.parent } - #{ page.title }") || data.priority.length + end + end + + def get_pages + sitemap.resources.select { |resource| resource.data.type == 'page' } + .sort_by { |r| get_page_priority(r.data) } + end + + def get_secondary_pages + sitemap.resources.select { |resource| resource.data.type == 'page' and resource.data.secondary? } + .sort_by { |r| get_page_priority(r.data) } + end + + def get_page(priority) + sitemap.resources.select { |resource| resource.data.type == 'page' and get_page_priority(resource.data) == priority } + end + + def get_nested_pages(title) + sitemap.resources.select { |resource| resource.data.type == 'page' and resource.data.nested == true and resource.data.parent == title } + .sort_by { |r| get_page_priority(r.data) } + end + + def is_excluded_page(page) + page.data.nested? or page.data.children? or page.data.secondary? + end + + def is_page_active(page) + current_page.url == page + end + + def is_parent_page_active(page) + current_page.url.match(page) + end +end + +set :css_dir, 'assets/stylesheets' +set :js_dir, 'assets/javascripts' +set :images_dir, 'assets/images' +set :fonts_dir, 'assets/fonts' + +# Build-specific configuration +configure :build do + activate :minify_css + activate :minify_javascript + activate :relative_assets +end diff --git a/data/leo.yml b/data/leo.yml new file mode 100644 index 0000000..79540fc --- /dev/null +++ b/data/leo.yml @@ -0,0 +1,2 @@ +title: MVCSS +reading_time: false diff --git a/data/priority.yml b/data/priority.yml new file mode 100644 index 0000000..b0f3e05 --- /dev/null +++ b/data/priority.yml @@ -0,0 +1,18 @@ +- Overview +- Styleguide +- Styleguide - Basics +- Styleguide - The Numbers Game +- Styleguide - Comments +- Styleguide - Naming Conventions +- Manifest +- Foundation +- Foundation - Reset +- Foundation - Helpers +- Foundation - Config +- Foundation - Base +- Foundation - Tools +- Components +- Structures +- Vendor +- About +- Resources diff --git a/foundation/base/index.html b/foundation/base/index.html deleted file mode 100644 index 7c0b53e..0000000 --- a/foundation/base/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Foundation - Base / MVCSS
Toggle

Foundation - Base

Base contains all of the tag-level settings for default HTML elements. These are things like anchors, headings, paragraphs, lists, and everything else that doesn’t have a class name attached. Because there are so many possible HTML elements to cover, we typically only style the ones relevant to a project as we need them.

We define html and body styles at the top, and then divide the remaining content into Block and Inline sections.

// *************************************
//
//   Base
//   -> Tag-level settings
//
// *************************************

html
  background: $c-background
  color: $c-base
  font-family: $b-fontFamily
  font-size: $b-fontSize
  line-height: $b-lineHeight

body
  font-size: 100%

Block Content

Block content is made up of all the block-level elements needed in an MVCSS project. Typically, this section includes the aforementioned headings, paragraphs, lists, as well as figures, blockquotes, and more.

Collapsing margins, while an intentional feature of CSS, only add complexity when authoring style sheets, so we limit vertical margins on block-level elements to a single-direction.

// -------------------------------------
//   Block Content
// -------------------------------------

ul, p
  margin-bottom: $b-space
  margin-top: 0

li
  margin-bottom: $b-space-s
  margin-top: 0

// ----- Headers ----- //

h1, .h1,
h2, .h2,
h3, .h3,
h4, .h4
  font-family: $b-fontFamily-heading
  font-weight: bold
  line-height: 1.2
  margin-bottom: $b-space-xs
  margin-top: 0

Inline Content

Inline content is made up of—you guessed it—inline elements. These include tags like a, strong, em, code, and any others that don’t force a line break before and after themselves by default.

// -------------------------------------
//   Inline Content
// -------------------------------------

a
  border-bottom: $b-border
  color: $c-highlight
  text-decoration: none

  &:hover,
  &:focus
    border-bottom-color: $c-highlight
    color: $c-subdue
\ No newline at end of file diff --git a/foundation/config/index.html b/foundation/config/index.html deleted file mode 100644 index e3ecc61..0000000 --- a/foundation/config/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Foundation - Config / MVCSS
Toggle

Foundation - Config

Config holds your @font-face font setup (if applicable), and all of your application-wide variables. We include a set by default, which is broken down into Base, Colors, and Fonts.

@Font-face

If serving font files from a known path (e.g. your server), we include Bourbon’s +font-face mixin to simplify the daunting syntax, and also list fallback files needed for browser compatibility.

// -------------------------------------
//   @font-face
// -------------------------------------

// ----- Open Sans ----- //

+font-face('OpenSans', 'OpenSans')
+font-face('OpenSans', 'OpenSansBold', bold)
+font-face('OpenSans', 'OpenSansItalic', normal, italic)

Note: if you use a web font provider that offers fonts exclusively via a JavaScript snippet, you can expect to leave the @font-face section empty.

Variables

All variables in MVCSS are defined in Config and are prefixed by their role or respective Component/Structure.

  • $b-* for base variables
  • $c-* for colors
  • $g-* for breakpoints
  • $componentName-* for Components
  • $structureName-* for Structures

Colors are a somewhat complicated issue, but we’ve had the most success defining an initial palette (without color prefixes), and then referencing those colors within other varibles. In projects with a limited set of colors, you may not need a palette section, so we encourage you to choose the approach you prefer.

// -------------------------------------
//   Colors
// -------------------------------------

// ----- Palette ----- //

$cerulean: #017ba7
$forest: #7ba05b
$gainsboro: #ecf0f1
$gold: #ffd700
$jet: #343434
$scarlet: #ff3f00
$white: #fff

// ----- Base ----- //

$c-background-invert: $white
$c-background: $gainsboro
$c-border: lighten($jet, 30%)
$c-error: $scarlet
$c-highlight: $cerulean
$c-text-invert: $white
$c-text: $jet
$c-subdue: lighten($cerulean, 40%)
$c-success: $forest
$c-warning: $gold

// ----- Components ----- //

// Example: $row--a-background: $c-highlight

// ----- Structures ----- //

// Example: $dropdown-link-color: $c-subdue

// -------------------------------------
//   Base
// -------------------------------------

// ----- Borders & Box Shadow ----- //

$b-borderRadius: 3px
$b-borderStyle: solid
$b-borderWidth: 2px
$b-border: $b-borderWidth $b-borderStyle $c-border
$b-boxShadow: 0 2px 0 rgba($jet, 0.25)

// ----- Typography ----- //

$b-fontFamily-heading: 'OpenSans', sans-serif
$b-fontFamily: 'OpenSans', sans-serif
$b-fontSize: 16px
$b-fontSize-s: 75%
$b-fontSize-m: 90%
$b-fontSize-l: 115%
$b-lineHeight: 1.5

// ----- Sizing ----- //

$b-space: em(20px)
$b-space-s: 0.5 * $b-space
$b-space-l: 2 * $b-space
$b-space-xl: 4 * $b-space

// -------------------------------------
//   Components
// -------------------------------------

// ----- Grid ----- //

$g-s: em(480px)
$g-m: em(800px)
$g-l: em(1024px)

// -------------------------------------
//   Structures
// -------------------------------------

// ----- Dropdown ----- //

// Example: $dropdown-width: em(200px)
\ No newline at end of file diff --git a/foundation/helpers/index.html b/foundation/helpers/index.html deleted file mode 100644 index c217caf..0000000 --- a/foundation/helpers/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Foundation - Helpers / MVCSS
Toggle

Foundation - Helpers

Helpers are the functions, mixins, extends, and animations used throughout an MVCSS application.

Functions

Because of the many useful functions Sass gives us for free, we rarely need to define any of our own. Still, there may be occasions where you need to define some others (e.g., em, rem, strip-units). For these cases, we’ve dedicated the Functions section within Helpers to housing any necessary additions.

Mixins

We use mixins to reduce the amount of repeated code when authoring style sheets. Usually, this involves simplifying lengthy syntaxes, as well as providing fallbacks and vendor prefixes for unsupported CSS properties.

Take media queries for example: the most commonly used arguments are screen and min-width, so we made a mixin that includes those values as defaults, unless stated otherwise.

// ----- Respond-to ----- //
// -> Generates a media query
//
// $val - the breakpoint size
// $query - the type of query ('min-width', 'max-width')
// $media - the media type ('screen', 'print', etc.)
// @content - the generated content within the mixin
//

=respond-to($val, $query: min-width, $media: screen)
  @media #{$media} and ($query: $val)
    @content

By now using the respond-to mixin throughout a project, you can write less code to achieve the same result.

// Standard CSS
@media screen and (min-width: $g-m)

// Sass mixin
+respond-to($g-m)

Entries in the Mixin section should always take arguments and have the ability to differ when utilized. If you’re looking to add an unchanging group of properties to reuse, they belong in Extends.

Extends

Extends are collections of rules to use either directly in the markup, or to extend within modules. These are generally more verbose than Tools, but still adhere to the single responsibility principle.

Even though we frequently extend these classes within modules, we avoid the percent sign syntax (%className) to create placeholder selectors in Sass. It’s a good reminder to ourselves that these classes shouldn’t be nested in the context of anything else, avoiding potential selector bloat associated with extends.

Inside Markup

The group class applies multiple rules to a single element, and in the following example, we’re using it directly in the markup.

// ----- Clearfix ----- //

.group::after
  clear: both
  content: ''
  display: table
<footer class="group">
  <p class="fl">Made with Envy</p>
  <img class="fr" src="logo-envy.svg" alt="Envy Logo">
</footer>

Inside Modules

In the following g (grid) Component, we extend the group class within the module itself.

.g
  @extend .group
  display: block
  margin-left: -$g-gutter / 2
  margin-right: -$g-gutter / 2

Animations

Within Helpers, Animations are the general-use @keyframes definitions that can be called across various modules.

If you catch yourself defining a similar animation in two separate places, we try to abstract it into a single, less contextual animation that can be reused throughout a project.

For example, in the case of fadeIn, we’re likely to use this animation across many different modules, making it a perfect animation to define inside Helpers.

// ----- Fade In ----- //

@keyframes fadeIn
  0%
    opacity: 0
  100%
    opacity: 1

Note: animations unique to specific modules are defined at the bottom of their respective style sheets.

\ No newline at end of file diff --git a/foundation/index.html b/foundation/index.html deleted file mode 100644 index 57500f9..0000000 --- a/foundation/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Foundation / MVCSS
Toggle

Foundation

Foundation represents the tools and materials required at the ground level of an MVCSS project. In other words, it provides the initial setup for your application.

Foundation is made up of:

\ No newline at end of file diff --git a/foundation/reset/index.html b/foundation/reset/index.html deleted file mode 100644 index 9f6828a..0000000 --- a/foundation/reset/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Foundation - Reset / MVCSS
Toggle

Foundation - Reset

As long as the project size warrants it, kick things off with a reset style sheet. We use Normalize.css (and include it with MVCSS by default), but alternatives like Eric Meyer’s Reset CSS are easily interchangeable.

\ No newline at end of file diff --git a/foundation/tools/index.html b/foundation/tools/index.html deleted file mode 100644 index 78af92c..0000000 --- a/foundation/tools/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Foundation - Tools / MVCSS
Toggle

Foundation - Tools

Tools are presentational utility classes for usage directly in the markup itself. They’re helpful when you need a specific style in a unique context, but can’t justify creating (and naming) a new module or modifier to achieve the desired effect.

For example, the paragraph element inside of the following card Component needs its margin-bottom made flush, so we can easily apply a Tool class of mbf.

<div class="card">
  <p class="mbf">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam non dolor eligendi placeat.</p>
</div>

Using a Tool in this situation helps us avoid declaring a card or card modifier that assumes too much about its use case, while also helping to keep CSS specificity flat and managable.

Single Responsibility

Tools are as limited in responsibility as possible, allowing you to mix and match various classes to quickly produce many different styles. Every Tool does one thing and one thing well, ensuring that the elements they affect stay both predictable and extensible.

Going Too Far

If you find yourself using multiple Tools to achieve a reusable group of styles, it may be a sign that you should define those properties in their own module or modifier.

<a class="btn pbm pll prl ptm tsl" href="v3.zip" >Download v3.0.0</a>
<a class="btn pbm pll prl ptm tsl" href="v2.zip" >Download v2.4.1</a>

In the example above, we’re trying to create a large button by using only Tools. While our approach achieves the intended effect, we’re much better off defining those common styles in a .btn--l class, and then applying it in the markup.

.btn--l
  font-size: $b-fontSize-l
  padding: $b-space $b-space-l
<a class="btn btn--l" href="v3.zip" >Download v3.0.0</a>
<a class="btn btn--l" href="v2.zip" >Download v2.4.1</a>

This second approach also gives us a styling hook for any future changes to btn--l. Tools provide a powerful set of classes for fine-tuning unique contextual styles, but they aren’t a replacement for modular CSS practices.

\ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 6cc25c9..0000000 --- a/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Overview / MVCSS
Toggle

Overview

MVCSS [Modular View CSS] is a Sass-based CSS architecture for creating predictable and maintainable application style.

CSS, for all its simplicity, is a difficult language to manage in large-scale implementations. Naming, paths to abstraction, structure, and methodologies are all free-form; MVCSS seeks to provide order for these sorts of projects.

Keeping with an architecture motif, applications are split into three major categories: Foundation, Components, and Structures. If Foundation represents tools, materials, and the ground level, Components are akin to creating a window, while Structures mirror a number of windows and doors creating a wall.

For a very early taste, here’s what a simple Component might consist of:

// *************************************
//
//   Card
//   -> Individual style containers
//
// *************************************

.card
  background: $c-invert
  border-radius: $b-borderRadius
  box-shadow: $b-boxShadow
  padding: $b-space

// -------------------------------------
//   Modifiers
// -------------------------------------

// ----- Sizes ----- //

.card--s
  padding: $b-space-s

// ----- Theme ----- //

// Hierarchy

.card--b
  background: $c-highlight

// Error

.card--error
  border: 2px $b-borderStyle $c-error
  box-shadow: none

// -------------------------------------
//   Scaffolding
// -------------------------------------

// ----- Label ----- //

.card-label
  font-size: $b-fontSize-s
  font-weight: bold
  text-transform: uppercase

There’s no shortage of wonderful frameworks, ideas, and methods for tackling CSS across the web, and MVCSS wouldn’t exist without ideas set forth in few of these. Take a look at the Resources section to find out more about our architectural roots.

\ No newline at end of file diff --git a/manifest/index.html b/manifest/index.html deleted file mode 100644 index 45d4ba9..0000000 --- a/manifest/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Manifest / MVCSS
Toggle

Manifest

Now that we’ve touched on naming and piecemeal ideas, lets put it all together. MVCSS expects the following setup wherever your styles are found:

application.sass
foundation/
  _reset.sass
  _helpers.sass
  _config.sass
  _base.sass
  _tools.sass
components/
structures/
vendor/

application.sass is used as the manifest and inbox (more on that later). Application as a name is derived from the Rails asset pipeline, and all other files are Sass partials imported in.

Post compile, application.css is included on each site page and various settings can be employed for compression.

Imports

Files found in Foundation are imported into the manifest in a particular order, while Components and Structures are typically included alphabetically:

// *************************************
//
//   Project Name
//   -> Manifest
//
// *************************************

// -------------------------------------
//   Foundation
// -------------------------------------

@import 'foundation/reset'
@import 'foundation/helpers'
@import 'foundation/config'
@import 'foundation/base'

// -------------------------------------
//   Components
// -------------------------------------

// Component imports

// -------------------------------------
//   Structures
// -------------------------------------

// Structure imports

// -------------------------------------
//   Vendor
// -------------------------------------

// Third-party style imports, if needed

// -------------------------------------
//   Foundation - Tools
// -------------------------------------

@import 'foundation/tools'

// -------------------------------------
//   Inbox
// -------------------------------------

Splitting up large files

If any of the Foundation files become larger than desired, split the file into smaller, individual files. For example, if the Foundation - Config file grows too large:

  1. Create a foundation/config directory.
  2. Create partials for the foundation/_config.sass sections.
  3. Import the partial files in foundation/_config.sass.
// *************************************
//
//   Config
//   -> Fonts, Variables
//
// *************************************

@import 'foundation/config/fonts'
@import 'foundation/config/colors'
@import 'foundation/config/base'
@import 'foundation/config/components'
@import 'foundation/config/structures'
// ...

Inbox

Collaboration with developers can sometimes be difficult, but we’ve found a way to help mitigate that (at least as it relates to CSS). At the bottom of the application.sass file, there’s a comment block that looks like this:

// -------------------------------------
//   Inbox
// -------------------------------------

You can add any temporary styles to this section, which will allow the maintainer of the CSS to rewrite or sort the styles appropriately. We’ve found that developers respect (and even enjoy) this system, since they’re free from stressing over the proper placement or structure of a style rule.

\ No newline at end of file diff --git a/resources/index.html b/resources/index.html deleted file mode 100644 index 00f2325..0000000 --- a/resources/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Resources / MVCSS
Toggle

Resources

MVCSS Library

We maintain a Library of additional Helpers, Components, and documents that you may find useful in building your applications. These modules aren’t needed as commonly as the ones included with MVCSS by default, but our team has found plenty of use for them between projects.

Influences

We’re always on the lookout for new approaches and better means of abstraction. Here are some great resources and examples for writing better CSS that we’ve worked to incorporate into our thinking.

Methodologies

Libraries

Articles

Videos

\ No newline at end of file diff --git a/source/about.md b/source/about.md new file mode 100644 index 0000000..7bdd3bc --- /dev/null +++ b/source/about.md @@ -0,0 +1,28 @@ +--- +title: About +type: page +secondary: true +--- + +About +===== + +In the beginning, MVCSS was created by [Nick Walsh](http://twitter.com/nickawalsh) and [Drew Barontini](http://twitter.com/drewbarontini) as a means of formalizing their individual CSS methods. With version one of MVCSS, the ideas of contextual changes throughout a site were tied closely to the MVC, or Model View Controller, pattern, where higher-level body classes were applied for the Controller/View of the given page. This worked at first, but quickly grew unwiedly, and began to feel like an anti-pattern for how we *should* be writing our CSS. The change was made in version two, and, through the preceding versions, iteratively evolved MVCSS into a more mature framework. + +The Team +-------- + +Now, the front-end teams using and contributing to MVCSS are split across two companies, [Envy](http://envylabs.com) and [Code School](http://www.codeschool.com). Their shared experiences working across a vast array of large-scale client and product-based applications have helped to shape MVCSS into what it is today. + +### Envy + +- [Nick Walsh](http://twitter.com/nickawalsh) +- [Drew Powers](http://twitter.com/an_ennui) +- [John Wilson](http://twitter.com/jhnwlsn) + +### Code School + +- [Drew Barontini](http://twitter.com/drewbarontini) +- [Dan Denney](http://twitter.com/dandenney) +- [Jordan Wade](http://twitter.com/jjordanwade) +- [John D. Jameson](http://twitter.com/johndjameson) diff --git a/assets/images/favicon.ico b/source/assets/images/favicon.ico similarity index 100% rename from assets/images/favicon.ico rename to source/assets/images/favicon.ico diff --git a/assets/images/logo-envy.svg b/source/assets/images/logo-envy.svg similarity index 100% rename from assets/images/logo-envy.svg rename to source/assets/images/logo-envy.svg diff --git a/assets/images/logo.svg b/source/assets/images/logo.svg similarity index 100% rename from assets/images/logo.svg rename to source/assets/images/logo.svg diff --git a/source/assets/javascripts/application.js.coffee.erb b/source/assets/javascripts/application.js.coffee.erb new file mode 100644 index 0000000..4d2f883 --- /dev/null +++ b/source/assets/javascripts/application.js.coffee.erb @@ -0,0 +1,128 @@ +# ------------------------------------- +# Setup +# -> Namespace setup +# ------------------------------------- + +@Leo = {} +@Leo.Pager = {} + +# ------------------------------------- +# Heading Links +# -> Adds an anchor link next to each heading +# +# options.els - the heading elements +# ------------------------------------- + +Leo.headingLinks = (options) -> + options.els.each -> + el = $(@) + text = Leo.slugify( el.text() ) + el.attr('id', text) + el.prepend("#") + +# ------------------------------------- +# Read Time +# -> Adds an estimated reading time to each page +# +# options.text - the text of the page +# options.element - the element to append the reading time to +# options.wordsPerMinute - the words-per-minute to calculate against +# ------------------------------------- + +Leo.readTime = (options) -> + time = Math.ceil(options.text.split(' ').length / options.wordsPerMinute) + options.element.append("#{time} minute read") + +# ------------------------------------- +# Pager +# -> Adds keyboard navigation for pages +# +# id - the page id +# ------------------------------------- + +Leo.Pager = do -> + + pageIndex = 0 + + pages = [] + + shortcuts = + 'next': 39 + 'prev': 37 + + init = (id) -> + pageIndex = id + getPages() + setEventHandlers() + console.log pageIndex + + getPages = -> + <% get_pages.each do |p| %> + pages.push("<%= p.url %>") + <% end %> + + setEventHandlers = -> + $(document).on 'keydown', (e) -> + switch getKeyCode(e) + when shortcuts.next then gotoPage('next') + when shortcuts.prev then gotoPage('prev') + + getKeyCode = (e) -> + e = e || window.event + charCode = e.keyCode || e.which + charCode + + gotoPage = (dir) -> + switch dir + when 'next' + unless pageIndex == pages.length - 1 + window.location = pages[pageIndex + 1] + when 'prev' + unless pageIndex == 0 + window.location = pages[pageIndex - 1] + + init: init + +# ------------------------------------- +# Slugify +# -> Converts a string into a title slug +# +# text - the text to convert +# ------------------------------------- + +Leo.slugify = (text) -> + text.toLowerCase().replace(/\s+/g, '-').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '-').replace(/^-+/, '').replace(/-+$/, '') + +#------------------------------------- +# Document Ready +#------------------------------------- + +jQuery ($) -> + + Leo.headingLinks({ + els: $('h2, h3, h4, h5, h6') + }) + + <% if data.leo.reading_time %> + Leo.readTime({ + wordsPerMinute: 200 + text: $('.content').text() + element: $('.content h1') + }) + <% end %> + + Leo.Pager.init( $('body').data('id') ) + + $('.toggle').on 'click', (e) -> + e.preventDefault() + $(@).toggleClass('is-active') + $('body').toggleClass('is-sidebar-open') + $('.sidebar').toggleClass('is-open') + + $(document).on 'keyup', (event) -> + switch event.which + # 's' keyboard shortcut + when 83 + $('.toggle').toggleClass('is-active') + $('body').toggleClass('is-sidebar-open') + $('.sidebar').toggleClass('is-open') diff --git a/source/assets/stylesheets/_config.sass b/source/assets/stylesheets/_config.sass new file mode 100755 index 0000000..588d5db --- /dev/null +++ b/source/assets/stylesheets/_config.sass @@ -0,0 +1,79 @@ +// ************************************* +// +// Config +// -> Override Fonts, Variables +// +// ************************************* + +// ------------------------------------- +// @font-face +// ------------------------------------- + +$b-fontFamily-src: 'http://fonts.googleapis.com/css?family=Roboto+Slab:400,300,700' +$b-fontFamilyf-heading-src: 'http://fonts.googleapis.com/css?family=Roboto+Slab:400,300,700' + +// ------------------------------------- +// Colors +// ------------------------------------- + +// ----- Base ----- // + +$c-background-invert: #fff +$c-background: #ecf0f1 +$c-highlight: #4e4e5b +$c-secondary: lighten(#4e4e5b, 40%) +$c-subdue: lighten(#4e4e5b, 40%) +$c-text-invert: #fff +$c-text: #444 + +// ----- Structures ----- // + +// Header + +$header-background: darken($c-highlight, 10%) +$header-title-link-color: $c-text-invert +$header-title-link-hover-color: $c-subdue + +// Sidebar + +$sidebar-background: $c-highlight +$sidebar-label-color: $c-background +$sidebar-link-active-background: $c-background +$sidebar-link-active-color: $c-text +$sidebar-link-hover-background: darken($c-highlight, 10%) +$sidebar-link-hover-color: $c-text-invert +$sidebar-nav-sub-background: darken($c-highlight, 5%) + +// ------------------------------------- +// Base +// ------------------------------------- + +// ----- Typography ----- // + +$b-fontFamily-heading: 'Roboto Slab', serif +$b-fontFamily: 'Roboto Slab', serif + +// ----- Sizing ----- // + +$b-maxWidth: 46.875em + +// ----- Breakpoints ----- // + +$breakpoint-desk: 68.75em +$breakpoint-tablet: 50em + +// ------------------------------------- +// Structures +// ------------------------------------- + +// ----- Header ----- // + +$header-height: auto + +// ----- Sidebar ----- // + +$sidebar-collapsible: false +$sidebar-label-letterSpacing: 0.1em +$sidebar-link-fontSize: 85% +$sidebar-width: 17.1875em + diff --git a/source/assets/stylesheets/application.sass b/source/assets/stylesheets/application.sass new file mode 100755 index 0000000..3b7d1d0 --- /dev/null +++ b/source/assets/stylesheets/application.sass @@ -0,0 +1,54 @@ +// ************************************* +// +// Leo +// -> Manifest +// +// ************************************* + +@import "config" + +// ------------------------------------- +// Foundation +// ------------------------------------- + +@import "foundation/reset" +@import "foundation/helpers" +@import "foundation/config" +@import "foundation/base" + +// ------------------------------------- +// Components +// ------------------------------------- + +@import "components/bucket" +@import "components/card" +@import "components/cell" +@import "components/row" +@import "components/well" + +// ------------------------------------- +// Structures +// ------------------------------------- + +@import "structures/anchor" +@import "structures/header" +@import "structures/pager" +@import "structures/sidebar" +@import "structures/toggle" + +// ------------------------------------- +// Vendor +// ------------------------------------- + +@import "vendor/github" + +// ------------------------------------- +// Foundation - Tools +// ------------------------------------- + +@import "foundation/tools" + +// ------------------------------------- +// Inbox +// ------------------------------------- + diff --git a/source/assets/stylesheets/components/_bucket.sass b/source/assets/stylesheets/components/_bucket.sass new file mode 100755 index 0000000..908497f --- /dev/null +++ b/source/assets/stylesheets/components/_bucket.sass @@ -0,0 +1,51 @@ +// ************************************* +// +// Bucket +// -> Based on: +// * http://jsfiddle.net/necolas/rZvEF/ +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// .bucket[.bucket--flag] +// .bucket-media +// / ... +// .bucket-content +// / ... +// +// ************************************* + +.bucket + @extend .group + +// ------------------------------------- +// Modifiers +// ------------------------------------- + +// ----- Flag ----- // + +.bucket--flag + display: table + + .bucket-content + vertical-align: middle + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Content ----- // + +.bucket-content + display: table-cell + width: 10000px + +// ----- Media ----- // + +.bucket-media + float: left + margin-right: $b-space + > img + display: block + max-width: none diff --git a/source/assets/stylesheets/components/_card.sass b/source/assets/stylesheets/components/_card.sass new file mode 100755 index 0000000..8bb8e50 --- /dev/null +++ b/source/assets/stylesheets/components/_card.sass @@ -0,0 +1,31 @@ +// ************************************* +// +// Card +// -> Individual style containers +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// .card[.card--thin] +// / ... +// +// ************************************* + +.card + @extend .boxSizing + background: $c-background-invert + border-radius: $b-borderRadius + box-shadow: $b-boxShadow + padding: $b-space + position: relative + +// ------------------------------------- +// Modifiers +// ------------------------------------- + +// ----- Thin ----- // + +.card--thin + box-shadow: none + padding: 0.25em 0.5em diff --git a/source/assets/stylesheets/components/_cell.sass b/source/assets/stylesheets/components/_cell.sass new file mode 100755 index 0000000..ed41b3f --- /dev/null +++ b/source/assets/stylesheets/components/_cell.sass @@ -0,0 +1,24 @@ +// ************************************* +// +// Cell +// -> Width-limiting blocks +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// .cell +// +// ************************************* + +.cell + margin-left: auto + margin-right: auto + max-width: $b-maxWidth + position: relative + @if $sidebar-collapsible + .is-sidebar-open & + max-width: $b-maxWidth + $sidebar-width + @else + max-width: $b-maxWidth + $sidebar-width + diff --git a/source/assets/stylesheets/components/_row.sass b/source/assets/stylesheets/components/_row.sass new file mode 100755 index 0000000..5bdf02e --- /dev/null +++ b/source/assets/stylesheets/components/_row.sass @@ -0,0 +1,27 @@ +// ************************************* +// +// Row +// -> Width-spanning blocks +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// .row[.row--a] +// / ... +// +// ************************************* + +.row + overflow: hidden + padding: 0 $b-space + +// ------------------------------------- +// Modifiers +// ------------------------------------- + +// ----- Color Variants ----- // + +.row--a + background: $c-background-invert + diff --git a/source/assets/stylesheets/components/_well.sass b/source/assets/stylesheets/components/_well.sass new file mode 100755 index 0000000..c78cb0c --- /dev/null +++ b/source/assets/stylesheets/components/_well.sass @@ -0,0 +1,28 @@ +// ************************************* +// +// Well +// -> Vertical spacing +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// .well[.well--l] +// +// ************************************* + +.well + +respond-to($breakpoint-tablet) + margin-bottom: $b-space + margin-top: $b-space + +// ------------------------------------- +// Modifiers +// ------------------------------------- + +// ----- Sizes ----- // + +.well--l + margin-bottom: $b-space-l + margin-top: $b-space-l + diff --git a/source/assets/stylesheets/foundation/_base.sass b/source/assets/stylesheets/foundation/_base.sass new file mode 100755 index 0000000..3b4d661 --- /dev/null +++ b/source/assets/stylesheets/foundation/_base.sass @@ -0,0 +1,154 @@ +// ************************************* +// +// Base +// -> Tag-level settings +// +// ************************************* + +html + background: $c-background + color: $c-text + font-family: $b-fontFamily + font-size: $b-fontSize + line-height: $b-lineHeight + +body + font-size: 100% + &.is-sidebar-open + overflow-y: hidden + position: fixed + +respond-to($breakpoint-tablet) + position: static + +.content + +transform(translateX(0)) + +transition-transform(0.3s ease-in-out) + margin-bottom: $b-space-xl + padding-top: $b-space-xs + @if $sidebar-collapsible + .is-sidebar-open & + +transform(translateX($sidebar-width)) + margin-left: 0 + +respond-to($breakpoint-tablet) + +transform(translateX(0)) + margin-left: $sidebar-width + @else + .is-sidebar-open & + +transform(translateX($sidebar-width)) + +respond-to($breakpoint-tablet) + +transform(translateX(0)) + +respond-to($breakpoint-tablet) + margin-left: $sidebar-width + +// ------------------------------------- +// Block Content +// ------------------------------------- + +ul, ol, p + margin-bottom: $b-space + margin-top: 0 + +ul, ol + padding-left: $b-space-l + +li + margin-bottom: $b-space-s + margin-top: 0 + +li > ul, li > ol + margin-top: $b-space-s + +blockquote + color: $c-secondary + font-style: italic + margin-bottom: $b-space + margin-left: $b-space + margin-top: 0 + +pre, +code + font-family: $b-fontFamily-mono + +pre + @extend .card + margin-bottom: $b-space + +code + @extend .card + @extend .card--thin + +// ----- Headers ----- // + +h1, .h1, +h2, .h2, +h3, .h3, +h4, .h4, +h5, .h5, +h6, .h6 + font-family: $b-fontFamily-heading + font-weight: bold + line-height: 1.2 + margin-bottom: $b-space-s + margin-top: $b-space + @if $sidebar-collapsible == false + +respond-to($breakpoint-tablet) + margin-top: 0 + +respond-to($breakpoint-desk) + margin-top: $b-space + +h2, .h2, +h3, .h3, +h4, .h4, +h5, .h5, +h6, .h6 + position: relative + +respond-to($breakpoint-desk) + &:hover > a + display: block + +h1, .h1 + font-size: 200% + > b + color: $c-subdue + display: block + font-size: 50% + font-weight: normal + margin-top: $b-space-xs + +h2, .h2 + border-bottom: $b-border + font-size: 150% + margin-bottom: $b-space + margin-top: $b-space-l + padding-bottom: $b-space-xs + +h3, .h3 + font-size: 125% + +h4, .h4 + font-size: 110% + +h5, .h5 + font-size: 115% + +h6, .h6 + font-size: 105% + +// ------------------------------------- +// Inline Content +// ------------------------------------- + +a + border-bottom: $b-border + color: $c-highlight + text-decoration: none + transition: all 0.3s ease-in-out + &:hover, + &:focus + border-bottom-color: $c-highlight + color: $c-highlight + +img + @extend .card + height: auto + max-width: 100% diff --git a/source/assets/stylesheets/foundation/_config.sass b/source/assets/stylesheets/foundation/_config.sass new file mode 100644 index 0000000..be53028 --- /dev/null +++ b/source/assets/stylesheets/foundation/_config.sass @@ -0,0 +1,120 @@ +// ************************************* +// +// Config +// -> Fonts, Variables +// +// ************************************* + +// ------------------------------------- +// @font-face +// ------------------------------------- + +// ----- Variables ----- // + +$b-fontFamily-src: 'http://fonts.googleapis.com/css?family=Merriweather:400,700,400italic,700italic' !default +$b-fontFamily-heading-src: 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,700' !default + +// ----- Imports ----- // + +@if $b-fontFamily-src == $b-fontFamily-heading-src + @import url($b-fontFamily-src) +@else + @import url($b-fontFamily-src) + @import url($b-fontFamily-heading-src) + +// ------------------------------------- +// Colors +// ------------------------------------- + +// ----- Base ----- // + +$c-background-invert: #fff !default +$c-background: #ecf0f1 !default +$c-border: lighten(#95a5a6, 20%) !default +$c-highlight: #2c3e50 !default +$c-secondary: #666 !default +$c-subdue: #95a5a6 !default +$c-text-invert: #fff !default +$c-text: #333 !default + +// ----- Structures ----- // + +// Header + +$header-background: $c-background-invert !default +$header-title-link-color: $c-subdue !default +$header-title-link-hover-color: $c-text !default + +// Sidebar + +$sidebar-background: darken($c-background, 10%) !default +$sidebar-link-color: $c-secondary !default +$sidebar-link-active-background: $c-highlight !default +$sidebar-link-active-color: $c-text-invert !default +$sidebar-link-hover-background: darken($c-background, 20%) !default +$sidebar-link-hover-color: $c-text !default +$sidebar-nav-sub-background: none !default + +// Toggle + +$toggle-color: $c-subdue !default + +// ------------------------------------- +// Base +// ------------------------------------- + +// ----- Borders & Box Shadow ----- // + +$b-borderStyle: solid !default +$b-borderWidth: 2px !default +$b-border: $b-borderWidth $b-borderStyle $c-border !default +$b-borderRadius: 3px !default +$b-boxShadow: 0 2px 0 rgba(#333, 0.25) !default + +// ----- Typography ----- // + +$b-fontFamily-heading: 'Open Sans', serif !default +$b-fontFamily-mono: Courier, monospace !default +$b-fontFamily: 'Merriweather', serif !default +$b-fontSize: 16px !default +$b-fontSize-xs: 60% !default +$b-fontSize-s: 75% !default +$b-fontSize-m: 90% !default +$b-fontSize-l: 115% !default +$b-fontSize-xl: 150% !default +$b-lineHeight: 1.6 !default + +// ----- Sizing ----- // + +$b-maxWidth: em(600px) !default +$b-space: em(20px) !default +$b-space-xs: 0.25 * $b-space !default +$b-space-s: 0.5 * $b-space !default +$b-space-l: 2 * $b-space !default +$b-space-xl: 4 * $b-space !default + +// ----- Breakpoints ----- // + +$breakpoint-desk: 57.5em !default +$breakpoint-tablet: 41.25em !default + +// ------------------------------------- +// Structures +// ------------------------------------- + +// ----- Header ----- // + +$header-height: 45px !default +$header-title-align: left !default + +// ----- Sidebar ----- // + +$sidebar-collapsible: true !default +$sidebar-link-fontSize: 80% !default +$sidebar-width: 15.625em !default + +// ----- Toggle ----- // + +$toggle-height: 3px !default +$toggle-width: 24px !default + diff --git a/source/assets/stylesheets/foundation/_helpers.sass b/source/assets/stylesheets/foundation/_helpers.sass new file mode 100755 index 0000000..2f631b9 --- /dev/null +++ b/source/assets/stylesheets/foundation/_helpers.sass @@ -0,0 +1,61 @@ +// ************************************* +// +// Helpers +// -> Functions, Mixins, Animations +// +// ************************************* + +// ------------------------------------- +// Functions +// ------------------------------------- + +// ----- Em ----- // +// -> Converts pixel value to an em +// +// $target - the target pixel size +// $context - the context font-size + +@function em($target, $context: $b-fontSize) + @if ($target == 0) + @return 0 + @else + @return ($target / $context) * 1em + +// ------------------------------------- +// Mixins +// ------------------------------------- + +// ----- Respond-to ----- // + +=respond-to($val, $query: min-width, $media: screen) + @media #{$media} and ($query: $val) + @content + +// ----- Transform ----- // + +=transform($args) + -webkit-transform: $args + -ms-transform: $args + transform: $args + +// ----- Transition Transform ----- // + +=transition-transform($args...) + -webkit-transition: -webkit-transform $args + transition: -webkit-transform $args + transition: -moz-transform $args + transition: -ms-transform $args + transition: transform $args + +// ----- Transition ----- // + +=transition($args) + -webkit-transition: $args + transition: $args + +// ------------------------------------- +// Animations +// ------------------------------------- + +// ... + diff --git a/source/assets/stylesheets/foundation/_reset.scss b/source/assets/stylesheets/foundation/_reset.scss new file mode 100755 index 0000000..196d223 --- /dev/null +++ b/source/assets/stylesheets/foundation/_reset.scss @@ -0,0 +1,423 @@ +/*! normalize.css v3.0.0 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined in IE 8/9. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9. + * Hide the `template` element in IE, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9, Safari 5, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari 5 and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari 5, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9. + */ + +img { + border: 0; +} + +/** + * Correct overflow displayed oddly in IE 9. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari 5. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8+, and Opera + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/source/assets/stylesheets/foundation/_tools.sass b/source/assets/stylesheets/foundation/_tools.sass new file mode 100644 index 0000000..89444b4 --- /dev/null +++ b/source/assets/stylesheets/foundation/_tools.sass @@ -0,0 +1,317 @@ +// ************************************* +// +// Tools +// -> Global utilities +// +// ************************************* + +// ----- Box Sizing ----- // + +.boxSizing + -moz-box-sizing: border-box + box-sizing: border-box + +// ----- Clearfix ----- // + +.group::after + clear: both + content: '' + display: table + +// ----- Debug ----- // + +.debug + background-color: pink !important + +// ----- Ellipsis ----- // + +.ellipsis + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + +// ----- Image Replacement ----- // + +.ir + background-color: transparent + border: 0 + overflow: hidden + &::before + content: '' + display: block + width: 0 + height: 150% + +// ----- Semantic Hide ----- // + +.srt + border: 0 + clip: rect(0 0 0 0) + height: 1px + margin: -1px + overflow: hidden + padding: 0 + position: absolute + width: 1px + +// ------------------------------------- +// Background +// ------------------------------------- + +.bch + background: $c-highlight +.bci + background: $c-background-invert +.bcs + background: $c-subdue + +// ------------------------------------- +// Display +// ------------------------------------- + +.db + display: block +.di + display: inline +.dib + display: inline-block +.dn + display: none + +// ------------------------------------- +// Margins +// ------------------------------------- + +// ----- All ----- // + +.maxs + margin: $b-space-xs +.mas + margin: $b-space-s +.mam + margin: $b-space +.mal + margin: $b-space-l +.maxl + margin: $b-space-xl + +// ----- Bottom ----- // + +.mbf + margin-bottom: 0 +.mbxs + margin-bottom: $b-space-xs +.mbs + margin-bottom: $b-space-s +.mbm + margin-bottom: $b-space +.mbl + margin-bottom: $b-space-l +.mbxl + margin-bottom: $b-space-xl + +// ----- Horizontal ----- // + +.mhc + margin-left: auto + margin-right: auto + +// ----- Left ----- // + +.mlf + margin-left: 0 +.mlxs + margin-left: $b-space-xs +.mls + margin-left: $b-space-s +.mlm + margin-left: $b-space +.mll + margin-left: $b-space-l + +// ----- Right ----- // + +.mrf + margin-right: 0 +.mrxs + margin-right: $b-space-xs +.mrs + margin-right: $b-space-s +.mrm + margin-right: $b-space +.mrl + margin-right: $b-space-l + +// ----- Top ----- // + +.mtf + margin-top: 0 +.mtxs + margin-top: $b-space-xs +.mts + margin-top: $b-space-s +.mtm + margin-top: $b-space +.mtl + margin-top: $b-space-l +.mtxl + margin-top: $b-space-xl + +// ------------------------------------- +// Padding +// ------------------------------------- + +// ----- All ----- // + +.paxs + padding: $b-space-xs +.pas + padding: $b-space-s +.pam + padding: $b-space +.pal + padding: $b-space-l +.paxl + padding: $b-space-xl + +// ----- Bottom ----- // + +.pbf + padding-bottom: 0 +.pbxs + padding-bottom: $b-space-xs +.pbs + padding-bottom: $b-space-s +.pbm + padding-bottom: $b-space +.pbl + padding-bottom: $b-space-l +.pbxl + padding-bottom: $b-space-xl + +// ----- Left ----- // + +.plf + padding-left: 0 +.plxs + padding-left: $b-space-xs +.pls + padding-left: $b-space-s +.plm + padding-left: $b-space +.pll + padding-left: $b-space-l + +// ----- Right ----- // + +.prf + padding-right: 0 +.prxs + padding-right: $b-space-xs +.prs + padding-right: $b-space-s +.prm + padding-right: $b-space +.prl + padding-right: $b-space-l + +// ----- Top ----- // + +.ptf + padding-top: 0 +.ptxs + padding-top: $b-space-xs +.pts + padding-top: $b-space-s +.ptm + padding-top: $b-space +.ptl + padding-top: $b-space-l +.ptxl + padding-top: $b-space-xl + +// ------------------------------------- +// Positioning +// ------------------------------------- + +.fl + float: left +.fr + float: right + +.poa + position: absolute +.pof + position: fixed +.por + position: relative +.pos + position: static + +// ------------------------------------- +// Rounding +// ------------------------------------- + +.ra + border-radius: 50% +.ram + border-radius: $b-borderRadius +.ran + border-radius: 0 + +// ------------------------------------- +// Text +// ------------------------------------- + +// ----- Alignment ----- // + +.tac + text-align: center + +// ----- Color ----- // + +.tch + color: $c-highlight +.tci + color: $c-text-invert +.tcs + color: $c-subdue +.tct + color: $c-text + +// ----- Family ----- // + +.tfb + font-family: $b-fontFamily +.tfh + font-family: $b-fontFamily-heading + +// ----- Size ----- // + +.tsxs + font-size: $b-fontSize-xs +.tss + font-size: $b-fontSize-s +.tsm + font-size: $b-fontSize-m +.tsl + font-size: $b-fontSize-l +.tsxl + font-size: $b-fontSize-xl + +// ----- Style ----- // + +.tsi + font-style: italic + +// ----- Transform ----- // + +.ttu + text-transform: uppercase + +// ----- Weight ----- // + +.twn + font-weight: normal +.twb + font-weight: bold diff --git a/source/assets/stylesheets/structures/_anchor.sass b/source/assets/stylesheets/structures/_anchor.sass new file mode 100644 index 0000000..907a753 --- /dev/null +++ b/source/assets/stylesheets/structures/_anchor.sass @@ -0,0 +1,24 @@ +// ************************************* +// +// Anchor +// -> Appended link element +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// %a.anchor{ href: '#' } # +// +// ************************************* + +.anchor + border: 0 + display: none + bottom: 0 + left: -$b-space + padding-left: $b-space + padding-right: $b-space + margin-left: -$b-space + position: absolute + top: 0 + diff --git a/source/assets/stylesheets/structures/_header.sass b/source/assets/stylesheets/structures/_header.sass new file mode 100644 index 0000000..0e32068 --- /dev/null +++ b/source/assets/stylesheets/structures/_header.sass @@ -0,0 +1,55 @@ +// ************************************* +// +// Header +// -> Top bar +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// %header.header +// %h1.header-title Title +// +// ************************************* + +.header + @extend .boxSizing + background: $header-background + height: $header-height + padding: $b-space + position: relative + text-align: center + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Logo ----- // + +.header-logo + background: none + border-radius: 0 + box-shadow: none + display: block + padding: 0 + position: static + +// ----- Title ----- // + +.header-title + margin: 0 + text-transform: uppercase + > a + border: 0 + color: $header-title-link-color + &:hover, + &:focus + color: $header-title-link-hover-color + +// ----- Version ----- // + +.header-version + color: $c-subdue + font-weight: 300 + margin-bottom: 0 + diff --git a/source/assets/stylesheets/structures/_pager.sass b/source/assets/stylesheets/structures/_pager.sass new file mode 100644 index 0000000..b763258 --- /dev/null +++ b/source/assets/stylesheets/structures/_pager.sass @@ -0,0 +1,38 @@ +// ************************************* +// +// Pager +// -> Page navigation +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// %ul.pager +// %li.pager-item +// %a{ href: '#' } Previous page +// %li.pager-item +// %a{ href: '#' } Next page +// +// ************************************* + +.pager + border-top: $b-border + margin: 0 + padding: 0 + margin-top: $b-space-xl + padding-top: $b-space + text-align: center + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Item ----- // + +.pager-item + display: inline + list-style-type: none + margin-right: $b-space + &:last-child + margin-right: 0 + diff --git a/source/assets/stylesheets/structures/_sidebar.sass b/source/assets/stylesheets/structures/_sidebar.sass new file mode 100644 index 0000000..ff237a1 --- /dev/null +++ b/source/assets/stylesheets/structures/_sidebar.sass @@ -0,0 +1,115 @@ +// ************************************* +// +// Sidebar +// -> Page listing +// +// ************************************* +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// %aside.sidebar +// %a.sidebar-link{ href: '#' } Link +// +// ************************************* + +.sidebar + @extend .boxSizing + @if $sidebar-collapsible + +transform(translateX(-100%)) + +transition-transform(0.3s ease-in-out) + @else + +transform(translateX(-100%)) + +transition-transform(0.3s ease-in-out) + +respond-to($breakpoint-tablet) + +transform(translateX(0)) + background: $sidebar-background + bottom: 0 + left: 0 + overflow: scroll + position: fixed + top: 0 + width: $sidebar-width + z-index: 10 + +// ------------------------------------- +// States +// ------------------------------------- + +@if $sidebar-collapsible + .sidebar.is-open + +transform(translateX(0)) +@else + .sidebar.is-open + +transform(translateX(0)) + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Button ----- // + +.sidebar-btn + background: lighten($c-highlight, 10%) + border-color: darken($c-highlight, 10%) + border-radius: $b-borderRadius + color: $c-text-invert + display: block + line-height: 2.5 + margin: $b-space-s + padding: 0 $b-space + text-align: center + &:hover, + &:focus + background: lighten($c-highlight, 15%) + border-color: darken($c-highlight, 10%) + color: $c-text-invert + +// ----- Label ----- // + +.sidebar-label + border-bottom: $b-borderWidth $b-borderStyle $header-background + color: $sidebar-label-color + font-size: $sidebar-link-fontSize + font-weight: normal + letter-spacing: $sidebar-label-letterSpacing + margin: 0 + padding: 0 $b-space $b-space-s + text-transform: uppercase + +// ----- Link ----- // + +.sidebar-link + border: 0 + color: $sidebar-link-color + display: block + font-family: $b-fontFamily-heading + font-size: $sidebar-link-fontSize + padding: $b-space-s $b-space + &:hover, + &:focus + background: $sidebar-link-hover-background + color: $sidebar-link-hover-color + +// Sub + +.sidebar-link--sub + padding-left: $b-space-l + +// Active + +.sidebar-link.is-active + background: $sidebar-link-active-background + color: $sidebar-link-active-color + +// ----- Navigation ----- // + +// Sub + +.sidebar-nav-sub + background: $sidebar-nav-sub-background + display: none + +.sidebar-nav-sub.is-active + display: block + diff --git a/source/assets/stylesheets/structures/_toggle.sass b/source/assets/stylesheets/structures/_toggle.sass new file mode 100644 index 0000000..665ae9f --- /dev/null +++ b/source/assets/stylesheets/structures/_toggle.sass @@ -0,0 +1,89 @@ +// ************************************* +// +// Toggle +// -> Clickable icon +// +// ------------------------------------- +// Template (Haml) +// ------------------------------------- +// +// %a.toggle{ href: '#' } +// +// ************************************* + +.toggle + border: 0 + @if $sidebar-collapsible + display: block + @else + +respond-to($breakpoint-tablet) + display: none + height: 5 * $toggle-height + left: $b-space + position: absolute + top: $b-space + -webkit-backface-visibility: hidden + width: $toggle-width + z-index: 20 + +respond-to($breakpoint-tablet) + position: fixed + +// ------------------------------------- +// States +// ------------------------------------- + +// ----- Active ----- // + +.toggle.is-active + left: $sidebar-width + $b-space + + .toggle-icn-stack + background: none + &::before, + &::after + +transition(all 0.3s 0.2s ease-in-out) + top: 0 + &::before + +transform(rotate(-45deg)) + &::after + +transform(rotate(45deg)) + + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Icon ----- // + +.toggle-icn + border: 0 + display: block + height: 5 * $toggle-height + position: absolute + right: 0 + -webkit-backface-visibility: hidden + width: $toggle-width + +// Stack + +.toggle-icn-stack + +transition(all 0.3s ease-in-out) + background: $toggle-color + display: block + height: $toggle-height + margin-top: $toggle-height + width: $toggle-width + &::before, + &::after + +transition(all 0.3s ease-in-out) + background: $toggle-color + content: '' + display: block + height: $toggle-height + position: absolute + width: $toggle-width + z-index: 0 + &::before + top: -$toggle-height + &::after + top: (3 * $toggle-height) diff --git a/source/assets/stylesheets/vendor/_github.scss b/source/assets/stylesheets/vendor/_github.scss new file mode 100644 index 0000000..dc60655 --- /dev/null +++ b/source/assets/stylesheets/vendor/_github.scss @@ -0,0 +1,61 @@ +.hll { background-color: #ffffcc } +.c { color: #999988; font-style: italic } /* Comment */ +.err { color: #a61717; background-color: #e3d2d2 } /* Error */ +.k { color: #000000; font-weight: bold } /* Keyword */ +.o { color: #000000; font-weight: bold } /* Operator */ +.cm { color: #999988; font-style: italic } /* Comment.Multiline */ +.cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */ +.c1 { color: #999988; font-style: italic } /* Comment.Single */ +.cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ +.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ +.ge { color: #000000; font-style: italic } /* Generic.Emph */ +.gr { color: #aa0000 } /* Generic.Error */ +.gh { color: #999999 } /* Generic.Heading */ +.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ +.go { color: #888888 } /* Generic.Output */ +.gp { color: #555555 } /* Generic.Prompt */ +.gs { font-weight: bold } /* Generic.Strong */ +.gu { color: #aaaaaa } /* Generic.Subheading */ +.gt { color: #aa0000 } /* Generic.Traceback */ +.kc { color: #000000; font-weight: bold } /* Keyword.Constant */ +.kd { color: #000000; font-weight: bold } /* Keyword.Declaration */ +.kn { color: #000000; font-weight: bold } /* Keyword.Namespace */ +.kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */ +.kr { color: #000000; font-weight: bold } /* Keyword.Reserved */ +.kt { color: #445588; font-weight: bold } /* Keyword.Type */ +.m { color: #009999 } /* Literal.Number */ +.s { color: #d01040 } /* Literal.String */ +.na { color: #008080 } /* Name.Attribute */ +.nb { color: #0086B3 } /* Name.Builtin */ +.nc { color: #445588; font-weight: bold } /* Name.Class */ +.no { color: #008080 } /* Name.Constant */ +.nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */ +.ni { color: #800080 } /* Name.Entity */ +.ne { color: #990000; font-weight: bold } /* Name.Exception */ +.nf { color: #990000; font-weight: bold } /* Name.Function */ +.nl { color: #990000; font-weight: bold } /* Name.Label */ +.nn { color: #555555 } /* Name.Namespace */ +.nt { color: #000080 } /* Name.Tag */ +.nv { color: #008080 } /* Name.Variable */ +.ow { color: #000000; font-weight: bold } /* Operator.Word */ +.w { color: #bbbbbb } /* Text.Whitespace */ +.mf { color: #009999 } /* Literal.Number.Float */ +.mh { color: #009999 } /* Literal.Number.Hex */ +.mi { color: #009999 } /* Literal.Number.Integer */ +.mo { color: #009999 } /* Literal.Number.Oct */ +.sb { color: #d01040 } /* Literal.String.Backtick */ +.sc { color: #d01040 } /* Literal.String.Char */ +.sd { color: #d01040 } /* Literal.String.Doc */ +.s2 { color: #d01040 } /* Literal.String.Double */ +.se { color: #d01040 } /* Literal.String.Escape */ +.sh { color: #d01040 } /* Literal.String.Heredoc */ +.si { color: #d01040 } /* Literal.String.Interpol */ +.sx { color: #d01040 } /* Literal.String.Other */ +.sr { color: #009926 } /* Literal.String.Regex */ +.s1 { color: #d01040 } /* Literal.String.Single */ +.ss { color: #990073 } /* Literal.String.Symbol */ +.bp { color: #999999 } /* Name.Builtin.Pseudo */ +.vc { color: #008080 } /* Name.Variable.Class */ +.vg { color: #008080 } /* Name.Variable.Global */ +.vi { color: #008080 } /* Name.Variable.Instance */ +.il { color: #009999 } /* Literal.Number.Integer.Long */ diff --git a/source/components.md b/source/components.md new file mode 100644 index 0000000..8ef6082 --- /dev/null +++ b/source/components.md @@ -0,0 +1,52 @@ +--- +title: Components +type: page +--- + +Components +========== + +The beginnings of a recognizable user interface live in the Components directory. These are abstract, reasonably portable modules that can be swapped in and out of different projects with relative ease. + +Some Components, like `g` (grid) and `card`, are used for layout and containers, and can encompass many other modules. + +```html +
+
+
+ +
+
+
+
+ +
+
+
+``` + +**Note**: We shorten `grid` classes to `g` and `grid-box` classes to `g-b`. Since we write these grid classes so frequently, we want them to be as concise as possible. However, feel free to use the full words, if that's more comfortable for you. + +Other Components, like `thumb`, affect only a single element, and can resemble Tools at first glance. In these situations, both the Component and Tool have a single responsibility. The *Component*, however, may be declared alongside its modifier classes, while the Tool applies more definitive styles. + +```html +
+
+ Nick Walsh +
+
+

Nick Walsh

+
+
+``` + +Characteristics +--------------- + +When determing whether a module is a Component or Structure, we find it helpful to ask ourselves the following questions: + +- Does this module limit its scope as much as possible? +- Is this module independent of pre-existing Components? +- Is this module abstract enough to use in other projects without making significant changes? + +If you answer "no" to any of these questions, the module in question is more than likely a Structure. diff --git a/source/foundation/base.md b/source/foundation/base.md new file mode 100644 index 0000000..5f9fd23 --- /dev/null +++ b/source/foundation/base.md @@ -0,0 +1,89 @@ +--- +title: Base +type: page +parent: Foundation +nested: true +--- + +Foundation - Base +================= + +Base contains all of the tag-level settings for default HTML elements. These are things like anchors, headings, paragraphs, lists, and everything else that doesn't have a class name attached. Because there are so many possible HTML elements to cover, we typically only style the ones relevant to a project as we need them. + +We define `html` and `body` styles at the top, and then divide the remaining content into Block and Inline sections. + +```sass +// ************************************* +// +// Base +// -> Tag-level settings +// +// ************************************* + +html + background: $c-background + color: $c-base + font-family: $b-fontFamily + font-size: $b-fontSize + line-height: $b-lineHeight + +body + font-size: 100% +``` + +Block Content +------------- + +Block content is made up of all the block-level elements needed in an MVCSS project. Typically, this section includes the aforementioned headings, paragraphs, lists, as well as figures, blockquotes, and more. + +Collapsing margins, while an intentional feature of CSS, only add complexity when authoring style sheets, so we limit vertical margins on block-level elements to a [single-direction][csswizardry-margins]. + +```sass +// ------------------------------------- +// Block Content +// ------------------------------------- + +ul, p + margin-bottom: $b-space + margin-top: 0 + +li + margin-bottom: $b-space-s + margin-top: 0 + +// ----- Headers ----- // + +h1, .h1, +h2, .h2, +h3, .h3, +h4, .h4 + font-family: $b-fontFamily-heading + font-weight: bold + line-height: 1.2 + margin-bottom: $b-space-xs + margin-top: 0 +``` + +Inline Content +-------------- + +Inline content is made up of—you guessed it—inline elements. These include tags like `a`, `strong`, `em`, `code`, and any others that don't force a line break before and after themselves by default. + +```sass +// ------------------------------------- +// Inline Content +// ------------------------------------- + +a + border-bottom: $b-border + color: $c-highlight + text-decoration: none + + &:hover, + &:focus + border-bottom-color: $c-highlight + color: $c-subdue +``` + +[csswizardry-margins]: http://csswizardry.com/2012/06/single-direction-margin-declarations/ + diff --git a/source/foundation/config.md b/source/foundation/config.md new file mode 100644 index 0000000..65859c3 --- /dev/null +++ b/source/foundation/config.md @@ -0,0 +1,130 @@ +--- +title: Config +type: page +parent: Foundation +nested: true +--- + +Foundation - Config +=================== + +Config holds your `@font-face` font setup (if applicable), and all of your application-wide variables. We include a set by default, which is broken down into Base, Colors, and Fonts. + +@Font-face +---------- + +If serving font files from a known path (e.g. your server), we include Bourbon's `+font-face` [mixin][bourbon-mixin-fontface] to simplify the daunting syntax, and also list fallback files needed for browser compatibility. + +```sass +// ------------------------------------- +// @font-face +// ------------------------------------- + +// ----- Open Sans ----- // + ++font-face('OpenSans', 'OpenSans') ++font-face('OpenSans', 'OpenSansBold', bold) ++font-face('OpenSans', 'OpenSansItalic', normal, italic) +``` + +**Note:** if you use a web font provider that offers fonts exclusively via a JavaScript snippet, you can expect to leave the `@font-face` section empty. + +Variables +--------- + +All variables in MVCSS are defined in Config and are prefixed by their role or respective Component/Structure. + +- `$b-*` for base variables +- `$c-*` for colors +- `$g-*` for breakpoints +- `$componentName-*` for Components +- `$structureName-*` for Structures + +Colors are a somewhat complicated issue, but we've had the most success defining an initial palette (without color prefixes), and then referencing those colors within other varibles. In projects with a limited set of colors, you may not need a palette section, so we encourage you to choose the approach you prefer. + +```sass +// ------------------------------------- +// Colors +// ------------------------------------- + +// ----- Palette ----- // + +$cerulean: #017ba7 +$forest: #7ba05b +$gainsboro: #ecf0f1 +$gold: #ffd700 +$jet: #343434 +$scarlet: #ff3f00 +$white: #fff + +// ----- Base ----- // + +$c-background-invert: $white +$c-background: $gainsboro +$c-border: lighten($jet, 30%) +$c-error: $scarlet +$c-highlight: $cerulean +$c-text-invert: $white +$c-text: $jet +$c-subdue: lighten($cerulean, 40%) +$c-success: $forest +$c-warning: $gold + +// ----- Components ----- // + +// Example: $row--a-background: $c-highlight + +// ----- Structures ----- // + +// Example: $dropdown-link-color: $c-subdue + +// ------------------------------------- +// Base +// ------------------------------------- + +// ----- Borders & Box Shadow ----- // + +$b-borderRadius: 3px +$b-borderStyle: solid +$b-borderWidth: 2px +$b-border: $b-borderWidth $b-borderStyle $c-border +$b-boxShadow: 0 2px 0 rgba($jet, 0.25) + +// ----- Typography ----- // + +$b-fontFamily-heading: 'OpenSans', sans-serif +$b-fontFamily: 'OpenSans', sans-serif +$b-fontSize: 16px +$b-fontSize-s: 75% +$b-fontSize-m: 90% +$b-fontSize-l: 115% +$b-lineHeight: 1.5 + +// ----- Sizing ----- // + +$b-space: em(20px) +$b-space-s: 0.5 * $b-space +$b-space-l: 2 * $b-space +$b-space-xl: 4 * $b-space + +// ------------------------------------- +// Components +// ------------------------------------- + +// ----- Grid ----- // + +$g-s: em(480px) +$g-m: em(800px) +$g-l: em(1024px) + +// ------------------------------------- +// Structures +// ------------------------------------- + +// ----- Dropdown ----- // + +// Example: $dropdown-width: em(200px) +``` + + +[bourbon-mixin-fontface]: https://github.com/thoughtbot/bourbon/blob/master/core/bourbon/library/_font-face.scss diff --git a/source/foundation/helpers.md b/source/foundation/helpers.md new file mode 100644 index 0000000..e6c90a2 --- /dev/null +++ b/source/foundation/helpers.md @@ -0,0 +1,112 @@ +--- +title: Helpers +type: page +parent: Foundation +nested: true +--- + +Foundation - Helpers +==================== + +Helpers are the functions, mixins, extends, and animations used throughout an MVCSS application. + +Functions +--------- + +Because of the many useful functions Sass gives us for free, we rarely need to define any of our own. Still, there may be occasions where you need to define some others (e.g., `em`, `rem`, `strip-units`). For these cases, we've dedicated the Functions section within Helpers to housing any necessary additions. + +Mixins +------ + +We use mixins to reduce the amount of repeated code when authoring style sheets. Usually, this involves simplifying lengthy syntaxes, as well as providing fallbacks and vendor prefixes for unsupported CSS properties. + +Take media queries for example: the most commonly used arguments are `screen` and `min-width`, so we made a mixin that includes those values as defaults, unless stated otherwise. + +```sass +// ----- Respond-to ----- // +// -> Generates a media query +// +// $val - the breakpoint size +// $query - the type of query ('min-width', 'max-width') +// $media - the media type ('screen', 'print', etc.) +// @content - the generated content within the mixin +// + +=respond-to($val, $query: min-width, $media: screen) + @media #{$media} and ($query: $val) + @content +``` + +By now using the `respond-to` mixin throughout a project, you can write less code to achieve the same result. + +```sass +// Standard CSS +@media screen and (min-width: $g-m) + +// Sass mixin ++respond-to($g-m) +``` + +Entries in the Mixin section should always take arguments and have the ability to differ when utilized. If you're looking to add an unchanging group of properties to reuse, they belong in Extends. + +Extends +------- + +Extends are collections of rules to use either directly in the markup, or to *extend* within modules. These are generally more verbose than Tools, but still adhere to the single responsibility principle. + +Even though we frequently extend these classes within modules, we avoid the percent sign syntax (`%className`) to create placeholder selectors in Sass. It's a good reminder to ourselves that these classes shouldn't be nested in the context of anything else, avoiding potential [selector bloat][csswizardry-extends] associated with extends. + +### Inside Markup + +The `group` class applies multiple rules to a single element, and in the following example, we're using it directly in the markup. + +```sass +// ----- Clearfix ----- // + +.group::after + clear: both + content: '' + display: table +``` + +```html + +``` + +### Inside Modules + +In the following `g` (grid) Component, we extend the `group` class within the module itself. + +```sass +.g + @extend .group + display: block + margin-left: -$g-gutter / 2 + margin-right: -$g-gutter / 2 +``` + +Animations +---------- + +Within Helpers, Animations are the general-use `@keyframes` definitions that can be called across various modules. + +If you catch yourself defining a similar animation in two separate places, we try to abstract it into a single, less contextual animation that can be reused throughout a project. + +For example, in the case of `fadeIn`, we're likely to use this animation across many different modules, making it a perfect animation to define inside Helpers. + +```sass +// ----- Fade In ----- // + +@keyframes fadeIn + 0% + opacity: 0 + 100% + opacity: 1 +``` + +**Note:** animations unique to specific modules are defined at the bottom of their respective style sheets. + +[csswizardry-extends]: http://csswizardry.com/2014/01/extending-silent-classes-in-sass/ diff --git a/source/foundation/index.md b/source/foundation/index.md new file mode 100644 index 0000000..666b1b0 --- /dev/null +++ b/source/foundation/index.md @@ -0,0 +1,18 @@ +--- +title: Foundation +type: page +children: true +--- + +Foundation +========== + +Foundation represents the tools and materials required at the ground level of an MVCSS project. In other words, it provides the initial setup for your application. + +Foundation is made up of: + +- [Reset](/foundation/reset/) +- [Helpers](/foundation/helpers/) +- [Config](/foundation/config/) +- [Base](/foundation/base/) +- [Tools](/foundation/tools/) diff --git a/source/foundation/reset.md b/source/foundation/reset.md new file mode 100644 index 0000000..afab22f --- /dev/null +++ b/source/foundation/reset.md @@ -0,0 +1,14 @@ +--- +title: Reset +type: page +parent: Foundation +nested: true +--- + +Foundation - Reset +================== + +As long as the project size warrants it, kick things off with a reset style sheet. We use [Normalize.css][normalize] (and include it with MVCSS by default), but alternatives like Eric Meyer's [Reset CSS][meyer-reset] are easily interchangeable. + +[normalize]: http://necolas.github.io/normalize.css/ +[meyer-reset]: http://meyerweb.com/eric/tools/css/reset/reset.css diff --git a/source/foundation/tools.md b/source/foundation/tools.md new file mode 100644 index 0000000..c59b07b --- /dev/null +++ b/source/foundation/tools.md @@ -0,0 +1,51 @@ +--- +title: Tools +type: page +parent: Foundation +nested: true +--- + +Foundation - Tools +================== + +Tools are presentational utility classes for usage directly in the markup itself. They're helpful when you need a specific style in a unique context, but can't justify creating (and naming) a new module or modifier to achieve the desired effect. + +For example, the paragraph element inside of the following `card` Component needs its `margin-bottom` made flush, so we can easily apply a Tool class of `mbf`. + +```html +
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam non dolor eligendi placeat.

+
+``` + +Using a Tool in this situation helps us avoid declaring a `card` or `card` modifier that assumes too much about its use case, while also helping to keep CSS specificity flat and managable. + +Single Responsibility +--------------------- + +Tools are as limited in responsibility as possible, allowing you to mix and match various classes to quickly produce many different styles. Every Tool does one thing and one thing well, ensuring that the elements they affect stay both predictable and extensible. + +Going Too Far +------------- + +If you find yourself using multiple Tools to achieve a reusable group of styles, it may be a sign that you should define those properties in their own module or modifier. + +```html +Download v3.0.0 +Download v2.4.1 +``` + +In the example above, we're trying to create a large button by using only Tools. While our approach achieves the intended effect, we're much better off defining those common styles in a `.btn--l` class, and then applying it in the markup. + +```sass +.btn--l + font-size: $b-fontSize-l + padding: $b-space $b-space-l +``` + +```html +Download v3.0.0 +Download v2.4.1 +``` + +This second approach also gives us a styling hook for any future changes to `btn--l`. Tools provide a powerful set of classes for fine-tuning unique contextual styles, but they aren't a replacement for modular CSS practices. diff --git a/source/index.md b/source/index.md new file mode 100644 index 0000000..731e509 --- /dev/null +++ b/source/index.md @@ -0,0 +1,71 @@ +--- +title: Overview +type: page +--- + +Overview +======== + +**MVCSS** [Modular View CSS] is a Sass-based CSS architecture for creating predictable and maintainable application style. + +CSS, for all its simplicity, is a difficult language to manage in large-scale implementations. Naming, paths to abstraction, structure, and methodologies are all free-form; MVCSS seeks to provide order for these sorts of projects. + +Keeping with an architecture motif, applications are split into three major categories: [*Foundation*][foundation], [*Components*][components], and [*Structures*][structures]. If Foundation represents tools, materials, and the ground level, Components are akin to creating a window, while Structures mirror a number of windows and doors creating a wall. + +For a very early taste, here’s what a simple Component might consist of: + +```sass +// ************************************* +// +// Card +// -> Individual style containers +// +// ************************************* + +.card + background: $c-invert + border-radius: $b-borderRadius + box-shadow: $b-boxShadow + padding: $b-space + +// ------------------------------------- +// Modifiers +// ------------------------------------- + +// ----- Sizes ----- // + +.card--s + padding: $b-space-s + +// ----- Theme ----- // + +// Hierarchy + +.card--b + background: $c-highlight + +// Error + +.card--error + border: 2px $b-borderStyle $c-error + box-shadow: none + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Label ----- // + +.card-label + font-size: $b-fontSize-s + font-weight: bold + text-transform: uppercase +``` + +There’s no shortage of wonderful frameworks, ideas, and methods for tackling CSS across the web, and MVCSS wouldn’t exist without ideas set forth in few of these. Take a look at the [Resources][resources] section to find out more about our architectural roots. + + +[components]: /components +[foundation]: /foundation +[resources]: /resources +[structures]: /structures diff --git a/source/layouts/layout.haml b/source/layouts/layout.haml new file mode 100644 index 0000000..7ff1352 --- /dev/null +++ b/source/layouts/layout.haml @@ -0,0 +1,38 @@ +!!! 5 +%html{ :lang => 'en' } + %head + %meta{ :charset => 'utf-8' } + %meta{ :content => 'IE=edge,chrome=1', 'http-equiv' => 'X-UA-Compatible' } + %meta{ :name => 'viewport', :content => 'width=device-width, initial-scale=1.0' } + - unless current_page.data.nested + %title= "#{current_page.data.title} / #{data.leo.title}" || data.leo.title + - else + %title= "#{current_page.data.parent} - #{current_page.data.title} / #{data.leo.title}" || data.leo.title + %meta{ :name => "description", :content => "MVCSS - A Sass-based CSS architecture for creating predictable and maintainable application style." } + + = stylesheet_link_tag 'application' + + = partial 'shared/google_analytics' if build? + + %body{ class: page_classes, 'data-id' => get_page_priority(current_page.data) } + + = link_to '#', class: 'toggle' do + .toggle-icn + .toggle-icn-stack + %b.srt Toggle + + = partial 'shared/sidebar' + + .row + .cell.well + + %main.content + %article + = find_and_preserve do + = yield + + = partial 'shared/pager' + + = partial 'shared/gauges' if build? + = javascript_include_tag 'http://code.jquery.com/jquery-1.11.1.min.js' + = javascript_include_tag 'application' diff --git a/source/manifest.md b/source/manifest.md new file mode 100644 index 0000000..c2b6463 --- /dev/null +++ b/source/manifest.md @@ -0,0 +1,114 @@ +--- +title: Manifest +type: page +--- + +Manifest +======== + +Now that we’ve touched on naming and piecemeal ideas, lets put it all together. MVCSS expects the following setup wherever your styles are found: + +```text +application.sass +foundation/ + _reset.sass + _helpers.sass + _config.sass + _base.sass + _tools.sass +components/ +structures/ +vendor/ +``` + +`application.sass` is used as the manifest and inbox (more on that later). Application as a name is derived from the Rails asset pipeline, and all other files are Sass partials imported in. + +Post compile, `application.css` is included on each site page and various settings can be employed for compression. + +Imports +------- + +Files found in Foundation are imported into the manifest in a particular order, while Components and Structures are typically included alphabetically: + +```sass +// ************************************* +// +// Project Name +// -> Manifest +// +// ************************************* + +// ------------------------------------- +// Foundation +// ------------------------------------- + +@import 'foundation/reset' +@import 'foundation/helpers' +@import 'foundation/config' +@import 'foundation/base' + +// ------------------------------------- +// Components +// ------------------------------------- + +// Component imports + +// ------------------------------------- +// Structures +// ------------------------------------- + +// Structure imports + +// ------------------------------------- +// Vendor +// ------------------------------------- + +// Third-party style imports, if needed + +// ------------------------------------- +// Foundation - Tools +// ------------------------------------- + +@import 'foundation/tools' + +// ------------------------------------- +// Inbox +// ------------------------------------- +``` + +### Splitting up large files + +If any of the Foundation files become larger than desired, split the file into smaller, individual files. For example, if the Foundation - Config file grows too large: + +1. Create a `foundation/config` directory. +2. Create partials for the `foundation/_config.sass` sections. +3. Import the partial files in `foundation/_config.sass`. + +```sass +// ************************************* +// +// Config +// -> Fonts, Variables +// +// ************************************* + +@import 'foundation/config/fonts' +@import 'foundation/config/colors' +@import 'foundation/config/base' +@import 'foundation/config/components' +@import 'foundation/config/structures' +// ... +``` + +Inbox +----- + +Collaboration with developers can sometimes be difficult, but we've found a way to help mitigate that (at least as it relates to CSS). At the bottom of the `application.sass` file, there's a comment block that looks like this: + +```sass +// ------------------------------------- +// Inbox +// ------------------------------------- +``` + +You can add any temporary styles to this section, which will allow the maintainer of the CSS to rewrite or sort the styles appropriately. We've found that developers respect (and even enjoy) this system, since they're free from stressing over the proper placement or structure of a style rule. diff --git a/source/resources.md b/source/resources.md new file mode 100644 index 0000000..b693fb3 --- /dev/null +++ b/source/resources.md @@ -0,0 +1,50 @@ +--- +title: Resources +type: page +secondary: true +--- + +Resources +========= + +MVCSS Library +------------- + +We maintain a [Library][library] of additional Helpers, Components, and documents that you may find useful in building your applications. These modules aren't needed as commonly as the ones included with MVCSS by default, but our team has found plenty of use for them between projects. + + +Influences +---------- + +We’re always on the lookout for new approaches and better means of abstraction. Here are some great resources and examples for writing better CSS that we’ve worked to incorporate into our thinking. + + +### Methodologies + +- [OOCSS](http://oocss.org) +- [SMACSS](http://smacss.com) +- [BEM](http://bem.info/method) + +### Libraries + +- [Foundation](http://foundation.zurb.com) +- [Bootstrap](http://getbootstrap.com) +- [SUIT](https://github.com/suitcss/suit) +- [inuit.css](https://github.com/csswizardry/inuit.css) + +### Articles + +- [CSS Architecture](http://philipwalton.com/articles/css-architecture/) +- [Code Smells](http://csswizardry.com/2012/11/code-smells-in-css) +- [Selector Intent](http://csswizardry.com/2012/07/shoot-to-kill-css-selector-intent) +- [Atomic CSS](http://coding.smashingmagazine.com/2013/10/21/challenging-css-best-practices-atomic-approach) +- [Single Responsibility](http://drewbarontini.com/articles/single-responsibility/) + +### Videos + +- [Architecting Scalable CSS](https://vimeo.com/70041549) +- [Rationalising Designs for Better Quality Code](https://vimeo.com/78899870) +- [Your CSS Is a Mess](https://vimeo.com/61755493) + + +[library]: https://github.com/mvcss/library diff --git a/source/shared/_gauges.haml b/source/shared/_gauges.haml new file mode 100644 index 0000000..4a47d72 --- /dev/null +++ b/source/shared/_gauges.haml @@ -0,0 +1,12 @@ +:javascript + var _gauges = _gauges || []; + (function() { + var t = document.createElement('script'); + t.type = 'text/javascript'; + t.async = true; + t.id = 'gauges-tracker'; + t.setAttribute('data-site-id', '4fe1bcaa613f5d1bfe000020'); + t.src = '//secure.gaug.es/track.js'; + var s = document.getElementsByTagName('script')[0]; + s.parentNode.insertBefore(t, s); + })(); diff --git a/source/shared/_google_analytics.haml b/source/shared/_google_analytics.haml new file mode 100644 index 0000000..9c5c823 --- /dev/null +++ b/source/shared/_google_analytics.haml @@ -0,0 +1,10 @@ +:javascript + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-32794837-1']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); diff --git a/source/shared/_pager.haml b/source/shared/_pager.haml new file mode 100755 index 0000000..4a80640 --- /dev/null +++ b/source/shared/_pager.haml @@ -0,0 +1,15 @@ +- if get_page(get_page_priority(current_page.data) - 1) + %ul.pager + + - if get_page(get_page_priority(current_page.data) - 1) + - get_page(get_page_priority(current_page.data) - 1).each do |p| + %li.pager-item + = link_to "/#{p.path}" do + ← Previous page + + - if get_page(get_page_priority(current_page.data) + 1) + - get_page(get_page_priority(current_page.data) + 1).each do |p| + %li.pager-item + = link_to "/#{p.path}" do + Next page → + diff --git a/source/shared/_sidebar.haml b/source/shared/_sidebar.haml new file mode 100755 index 0000000..86ab969 --- /dev/null +++ b/source/shared/_sidebar.haml @@ -0,0 +1,27 @@ +%aside.sidebar + + %header.header + .bucket.bucket--flag + .bucket-media + = image_tag 'logo.svg', alt: 'MVCSS', class: 'header-logo', width: '100', height: '110' + .bucket-content + %p.h1.header-title= link_to data.leo.title, '/index.html' + %p.header-version Version 4.1.1 + + = link_to 'View on GitHub', 'http://github.com/mvcss/mvcss', class: 'sidebar-btn' + + %nav.sidebar-nav + - get_pages.each do |page| + - unless is_excluded_page(page) + = link_to page.data.title, "/#{page.path}", class: (is_page_active(page.url) ? 'sidebar-link is-active' : 'sidebar-link') + - else + - if page.data.children? + = link_to page.data.title, "/#{page.path}", class: (is_page_active(page.url) ? 'sidebar-link sidebar-link--parent is-active' : 'sidebar-link') + .sidebar-nav-sub{ class: ('is-active' if is_parent_page_active(page.url))} + - get_nested_pages(page.data.title).each do |nested_page| + = link_to nested_page.data.title, "/#{nested_page.path}", class: (is_page_active(nested_page.url) ? 'sidebar-link sidebar-link--sub is-active' : 'sidebar-link sidebar-link--sub') + .sidebar-nav-secondary + %h3.sidebar-label.mtl Meta + - get_secondary_pages().each do |page| + = link_to page.data.title, "/#{page.path}", class: (is_page_active(page.url) ? 'sidebar-link is-active' : 'sidebar-link') + diff --git a/source/structures.md b/source/structures.md new file mode 100644 index 0000000..6aef362 --- /dev/null +++ b/source/structures.md @@ -0,0 +1,144 @@ +--- +title: Structures +type: page +--- + +Structures +========== + +Structures are a project's modules and user interface elements that are too specialized for use across multiple sites. In some cases, they might assume a certain context or content type, and in other cases, they might include thematic styles or responsive layout. + +When explaining what characterizes a Component versus a Structure, we outlined a few considerations that help us determine between the two: + +- Size of scope +- Dependencies on other modules +- Portability between projects, or lack thereof + +Size of Scope +------------- + +When a module affects different aspects of an element or arrangement of elements simultaneously (i.e., it has a wide *scope*), that's a very strong indicator that you're dealing with a Structure. + +Let's say, for example, you're designing a fairly common site header: logo on the left, plus some horizontal navigation on the right. You could realistically build this pattern using a combination of Helpers, Components, and Tools. + +```html +
+ Website + +
+``` + +But what happens when we try to make our site responsive? On small-screen devices, we want our navigation to also: + +- Fill the viewport width +- Stack links atop one another +- Apply an alternating background color to each list item + +See the problem? Our module definitely isn't `list--inline` anymore. It now needs its own aesthetics and responsive behavior—both of which are tailored to their surrounding design. Although we might use this pattern in multiple places on the site, its broad scope makes copying it across different designs unlikely. In this case, our best bet is to create a new Structure, and define our new themed, responsive list module inside. + +Dependencies +------------ + +Unlike Components, Structures can depend on, or even extend, pre-existing Components. This is useful when you want to add theme or behavior to a Component, but keep any unique changes contained within their own module. + +In MVCSS, we use our `g` (grid) Component primarily for page layout. We try to keep it simple and assume as little as possible, but there are cases where we want to include similar functionality inside of a more specific module. Float-based grids don't always behave predictably when their items have variable a height, so we've defined a `collection` Structure to add contextual clearfixing. + +```sass +.collection + +// ------------------------------------- +// Modifiers +// ------------------------------------- + +.collection--1of3 + + .collection-item:nth-child(3n + 1) + clear: left + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Item ----- // + +.collection-item + margin-bottom: $b-space-l +``` + +Using both the `g` (grid) Component and the `collection` Structure, we can apply both modules' classes directly in the markup. + +**Note:** applying multiple modifiers to `grid` and `grid-box` can make markup difficult to read quickly, so we've shortened the classes to `g` and `g-b`. + +```html +
+
+ +
+
+ +
+
+ +
+
+ +
+
+``` + +But that's a lot of classes to keep track of! Luckily, Sass can help us simplify our markup thanks to its `@extend` directive. + +```sass +.collection + @extend .g + +// ------------------------------------- +// Modifiers +// ------------------------------------- + +.collection--1of3 + @extend .g-b--1of3 + + .collection-item:nth-child(3n + 1) + clear: left + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Item ----- // + +.collection-item + @extend .g-b + margin-bottom: $b-space-l +``` + +And now we apply only a *single set* of classes in the markup. + +```html +
+
+ +
+
+ +
+
+ +
+
+ +
+
+``` + +Portability +----------- + +In the end, limiting scope and minimizing dependencies both affect *portability*, which is usually our biggest concern when classifying modules. If you can easily tweak a few lines of CSS inside a module and use it between projects, that means it's reasonably portable, and you have solid grounds for classifying it as a Component. On the other hand, if try to port a module and find yourself rewriting a significant amount of code, then the module is likely better classified as a Structure. diff --git a/source/styleguide/basics.md b/source/styleguide/basics.md new file mode 100644 index 0000000..60c4b83 --- /dev/null +++ b/source/styleguide/basics.md @@ -0,0 +1,47 @@ +--- +title: Basics +type: page +parent: Styleguide +nested: true +--- + +Styleguide - Basics +=================== + +Style Sheets +------------ + +- Alphabetize properties (vendor-prefixed properties sorted by their non-prefixed equivalent) +- Extends and Mixins should be placed before standard properties +- Use soft tabs with a two space indention +- Add a space after `:` +- Add a space after `//` comments +- Add a space after commas in values (e.g. `rgba(#000, 0.5)`) +- Write numbers at the end of mathematic operations (e.g. `$b-space * 0.5`) +- Stick with classes instead of IDs for styling +- Limit nesting as much as possible + +```sass +// Example + +.component + @extend .group + +transition(opacity 0.2s ease-in-out) + border-radius: 5px + box-shadow: 0 2px 5px rgba(#000, 0.5) + -webkit-flex: 1 1 50% + -ms-flex: 1 1 50% + flex: 1 1 50% + font-style: italic + padding-bottom: $b-space * 3 +``` + +Markup +------ + +- Alphabetize classes, ordered by Component, Structure, Tool, state, and context +- Apply modifier classes after each individual module + +```html +
+``` diff --git a/source/styleguide/comments.md b/source/styleguide/comments.md new file mode 100644 index 0000000..6c12a70 --- /dev/null +++ b/source/styleguide/comments.md @@ -0,0 +1,28 @@ +--- +title: Comments +type: page +parent: Styleguide +nested: true +--- + +Styleguide - Comments +===================== + +There are four levels of comments, in order of decreasing importance: + +```sass +// ************************************* +// +// First Level +// -> Description +// +// ************************************* + +// ------------------------------------- +// Second Level +// ------------------------------------- + +// ----- Third Level ----- // + +// Fourth Level +``` diff --git a/source/styleguide/index.md b/source/styleguide/index.md new file mode 100644 index 0000000..6b856be --- /dev/null +++ b/source/styleguide/index.md @@ -0,0 +1,14 @@ +--- +title: Styleguide +type: page +children: true +--- + +Styleguide +========== + +Before diving in, we’ll start with a bit of housekeeping. This section outlines our internal standards for writing CSS (and more specifically, Sass). While you’re certainly welcome to switch it up, these guidelines will help in moving through our examples and base files. + +We’re big proponents of the Sass indented syntax (`.sass`), so things may look slightly different if you’re a Sassy CSS (`.scss`) fan. + +**Word of warning:** some of the sections herein will be a bit confusing, like Naming Conventions, until seen in context later—an unfortunate chicken/egg situation. diff --git a/source/styleguide/naming.md b/source/styleguide/naming.md new file mode 100644 index 0000000..82d47ab --- /dev/null +++ b/source/styleguide/naming.md @@ -0,0 +1,245 @@ +--- +title: Naming Conventions +type: page +parent: Styleguide +nested: true +--- + +Styleguide - Naming Conventions +=============================== + +Following ideas pioneered in [BEM][bem-definitions] and [SUIT][suit-naming-conventions], MVCSS has a strict series of naming conventions that provide context at a glance. + +Tools +----- + +As you may notice in `_tools.sass`, many of the Tool classes look pretty acronym-y. We’ll get into the gains inherent with defining Tools shortly, but for now just assume two- or three-letter classes fall under this notion. + +A class such as `.mbm` is a shorthand way to define a basic unit of bottom margin: **m**argin **b**ottom **m**edium. Similarly, `.mbl` would be the large variety of bottom margin. + +Components/Structures +--------------------- + +Structures and Components exist as Sass partials in their respective directories, and are always singular. Examples include `icon`, `button`, `g` (grid), `form`, and `modal`. + +If the name comprises two words, utilize `camelCase`—for instance, `taskList`. + +Modifiers +--------- + +After defining the base properties of a Component or Structure, modifiers exist to allow stylistic tweaks that build on the initial definition. These tweaks are denoted with two hyphens `--`. A button, for instance, might have a number of different colors and sizes: + +```sass +// ************************************* +// +// Button +// -> Action points +// +// ************************************* + +.btn + border: 0 + display: inline-block + line-height: 2.5 + padding: 0 $b-space + font-weight: bold + +// ------------------------------------- +// Modifiers +// ------------------------------------- + +// ----- Sizes ----- // + +.btn--s + font-size: 75% + +.btn--l + font-size: 150% + +// ----- Theme ----- // + +// Hierarchy + +.btn--a + background: $c-base + +.btn--b + background: $c-highlight +``` + +After creation, elements that need a modifier will use the root class (`.btn`) and any number of modifiers deemed necessary: + +```html + +``` + +**Note:** modifiers typically work best when defined in hierarchical sequence (`a`, `b`) or via function (`cancel`, `submit`) as opposed to look (`red`, `blue`). + +### Shorthand Notation + +As you can see above, we'll use shorthand notation for sizing and hierarchy modifiers. For example, rather than writing `btn--large`, we'll write `btn--l`. We do this for the sake of terseness, but feel free to write out the words, if that's more comfortable for you and your authors. + +Here are the shorthand notation modifier conventions that we use for sizing and hierarchy: + +```sass +// Sizing +--f (flush) +--xs (extra small) +--s (small) +--m (medium) +--l (large) +--xl (extra large) + +// Hierarchy +--a (primary) +--b (secondary) +--c (tertiary) +``` + +**Note**: If you go past tertiary on the hierarchy scale, you probably need a different modifier, as you have too many levels of hierarchy. + +States +------ + +Generally added via JavaScript, states are similar to modifiers but carry conditional context. `is-` denotes a state, such as `is-active`, and they’re utilized as such: + +```sass +// ************************************* +// +// Button +// -> Action points +// +// ************************************* + +.btn + // Styles + +// Modifiers + +// ------------------------------------- +// States +// ------------------------------------- + +.btn.is-active + background: $c-highlight +``` + +We use `is-active` as a convention throughout MVCSS, but any state can affect any module in a unique way. For example, applying `is-active` on an `btn` may have a completely different effect from applying `is-active` on a `nav-item`. By using only compound selectors (`.module.is-state`) to define state, we're able to increase specificity when needed, while also containing any changes within a single module's namespace. + +Context +------- + +We also borrow the idea of context from SUIT. Modularizing styles into self-contained units works well *most* of the time, but you’ll occasionally need a parent element to fall in line. + +The most common case tends to be positioning context. If you have a dropdown structure that’s being positioned absolutely, the parent element should be (at least) positioned relatively: + +```sass +// ************************************* +// +// Dropdown +// -> Revealed information +// +// ************************************* + +.dropdown + // Styles + +// Modifiers, States + +// ------------------------------------- +// Context +// ------------------------------------- + +.has-dropdown + position: relative +``` + +Similar to `is-` with states, classes beginning with `has-` denote a context selector. + +Scaffolding +----------- + +Elements nested within a Component or Structure that need styling *based on being there* can be added to the scaffolding. Keeping with the dropdown Structure, the scaffold section falls last: + +```sass +// ************************************* +// +// Dropdown +// -> Revealed information +// +// ************************************* + +.dropdown + // Styles + +// Modifiers, States, Context + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +.dropdown-media + border: 4px solid $c-invert +``` + +For items in scaffolding, the Component/Structure name comes first, followed by a single hyphen and the subcomponent/substructure name (also in camelCase, if necessary). Where applicable, they can have their own modifiers, states, and subcomponents/substructures—more than two levels, though, typically means it’s time to refactor. + +```sass +// ************************************* +// +// Card +// -> Individual style containers +// +// ************************************* + +.card + background: $c-invert + border-radius: $b-borderRadius + box-shadow: $b-boxShadow + padding: $b-space + position: relative + +// Modifiers, States, Context + +// ------------------------------------- +// Scaffolding +// ------------------------------------- + +// ----- Header ----- // + +.card-header + border-bottom: $b-border + margin-bottom: $b-space-s + margin-left: -$b-space + margin-right: -$b-space + padding-left: $b-space + padding-right: $b-space + +// Modifiers + +.card-header--push + margin-bottom: $b-space-l +``` + +In the `card` example above, we've defined a modifier class that affects the `card-header` scaffolding item. Applying the class directly to the element descendent of `card` helps us insert additional space when needed, while also keeping CSS specificity low. + +Variables +--------- + +Variables are a big enough consideration that we dedicate an entire file to keeping them organized. You can find all the information regarding variables in [Config][config]. + +Images +------ + +A section about naming images? I know. Let's just get through it. + +- `bg-*` for background images +- `logo-*` for logos +- `img-*` for content images +- Sub-folders for larger groups + + +[config]: /foundation/config + +[bem-definitions]: http://bem.info/method/definitions +[suit-naming-conventions]: https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md diff --git a/source/styleguide/numbers-game.md b/source/styleguide/numbers-game.md new file mode 100644 index 0000000..b465957 --- /dev/null +++ b/source/styleguide/numbers-game.md @@ -0,0 +1,28 @@ +--- +title: The Numbers Game +type: page +parent: Styleguide +nested: true +--- + +Styleguide - The Numbers Game +============================= + +As much as possible, we prefer sticking to relative units in a predictable scale. Base values are typically stored in Config (which we’ll cover in [Foundation][foundation]) and derived from that point on. For purposes of efficiency and standardization, you’ll define number values less often than usual in MVCSS. + +Approach +-------- + +- A pixel value for a base font size (stored in Config) is set on the root `html` element, thereby preparing both text sizing and the relative value of an em unit +- Line heights are unitless, e.g. `1.5` +- Spacing (padding, margin, etc.) is a multiple of a stored base space value, set in ems +- Font sizes (aside from the `html` element) are defined with percentage values, scaling the other relative properties on the element simultaneously + +This setup should be a easier to grasp once we reach the Config, Tools, and Base segments of Foundation. + +**Note:** pixel values will occasionally be required to meet design requirements, especially with things like offsets. Most often, these are considered [magic numbers][csswizardry-magic-numbers], and you should avoid using them as much as possible. + + +[foundation]: /foundation + +[csswizardry-magic-numbers]: http://csswizardry.com/2012/11/code-smells-in-css/ diff --git a/source/vendor.md b/source/vendor.md new file mode 100644 index 0000000..a098c1e --- /dev/null +++ b/source/vendor.md @@ -0,0 +1,18 @@ +--- +title: Vendor +type: page +--- + +Vendor +====== + +Vendor is where we include all third-party style sheets and is intentionally empty by default. + +Vendor may contain unaltered third-party code, as well as refactored modules from other libraries, frameworks, and UI toolkits. To include any `.css` files, you can change their file extentions to `.scss` and use `@import` as you would normally. + +If a snippet of code is portable and no larger than a single class, we usually paste these alongside others modules in the [Helpers][helpers] section. + +**Note:** although `_reset.sass` contains third-party code, we include it inside Foundation. This helps us organize low-level styles and prevent some potential source order dependency issues when authoring CSS. + + +[helpers]: /foundation/helpers/ diff --git a/structures/index.html b/structures/index.html deleted file mode 100644 index 936bbd8..0000000 --- a/structures/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Structures / MVCSS
Toggle

Structures

Structures are a project’s modules and user interface elements that are too specialized for use across multiple sites. In some cases, they might assume a certain context or content type, and in other cases, they might include thematic styles or responsive layout.

When explaining what characterizes a Component versus a Structure, we outlined a few considerations that help us determine between the two:

  • Size of scope
  • Dependencies on other modules
  • Portability between projects, or lack thereof

Size of Scope

When a module affects different aspects of an element or arrangement of elements simultaneously (i.e., it has a wide scope), that’s a very strong indicator that you’re dealing with a Structure.

Let’s say, for example, you’re designing a fairly common site header: logo on the left, plus some horizontal navigation on the right. You could realistically build this pattern using a combination of Helpers, Components, and Tools.

<header class="group">
    <img class="fl" src="logo.svg" alt="Website">
    <nav class="fr">
        <ul class="list list--inline">
            <li class="list-item"><a href="/">Home</a></li>
            <li class="list-item"><a href="/blog">Blog</a></li>
            <li class="list-item"><a href="/contact">Contact</a></li>
        </ul>
    </nav>
</header>

But what happens when we try to make our site responsive? On small-screen devices, we want our navigation to also:

  • Fill the viewport width
  • Stack links atop one another
  • Apply an alternating background color to each list item

See the problem? Our module definitely isn’t list--inline anymore. It now needs its own aesthetics and responsive behavior—both of which are tailored to their surrounding design. Although we might use this pattern in multiple places on the site, its broad scope makes copying it across different designs unlikely. In this case, our best bet is to create a new Structure, and define our new themed, responsive list module inside.

Dependencies

Unlike Components, Structures can depend on, or even extend, pre-existing Components. This is useful when you want to add theme or behavior to a Component, but keep any unique changes contained within their own module.

In MVCSS, we use our g (grid) Component primarily for page layout. We try to keep it simple and assume as little as possible, but there are cases where we want to include similar functionality inside of a more specific module. Float-based grids don’t always behave predictably when their items have variable a height, so we’ve defined a collection Structure to add contextual clearfixing.

.collection

// -------------------------------------
//   Modifiers
// -------------------------------------

.collection--1of3

  .collection-item:nth-child(3n + 1)
    clear: left

// -------------------------------------
//   Scaffolding
// -------------------------------------

// ----- Item ----- //

.collection-item
  margin-bottom: $b-space-l

Using both the g (grid) Component and the collection Structure, we can apply both modules’ classes directly in the markup.

Note: applying multiple modifiers to grid and grid-box can make markup difficult to read quickly, so we’ve shortened the classes to g and g-b.

<div class="g collection collection--1of3">
  <div class="g-b g-b--1of3 collection-item">
    <!-- Content -->
  </div>
  <div class="g-b g-b--1of3 collection-item">
    <!-- Content -->
  </div>
  <div class="g-b g-b--1of3 collection-item">
    <!-- Content -->
  </div>
  <div class="g-b g-b--1of3 collection-item">
    <!-- Content -->
  </div>
</div>

But that’s a lot of classes to keep track of! Luckily, Sass can help us simplify our markup thanks to its @extend directive.

.collection
  @extend .g

// -------------------------------------
//   Modifiers
// -------------------------------------

.collection--1of3
  @extend .g-b--1of3

  .collection-item:nth-child(3n + 1)
    clear: left

// -------------------------------------
//   Scaffolding
// -------------------------------------

// ----- Item ----- //

.collection-item
  @extend .g-b
  margin-bottom: $b-space-l

And now we apply only a single set of classes in the markup.

<div class="collection collection--1of3">
  <div class="collection-item">
    <!-- Content -->
  </div>
  <div class="collection-item">
    <!-- Content -->
  </div>
  <div class="collection-item">
    <!-- Content -->
  </div>
  <div class="collection-item">
    <!-- Content -->
  </div>
</div>

Portability

In the end, limiting scope and minimizing dependencies both affect portability, which is usually our biggest concern when classifying modules. If you can easily tweak a few lines of CSS inside a module and use it between projects, that means it’s reasonably portable, and you have solid grounds for classifying it as a Component. On the other hand, if try to port a module and find yourself rewriting a significant amount of code, then the module is likely better classified as a Structure.

\ No newline at end of file diff --git a/styleguide/basics/index.html b/styleguide/basics/index.html deleted file mode 100644 index 76e76c1..0000000 --- a/styleguide/basics/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Styleguide - Basics / MVCSS
Toggle

Styleguide - Basics

Style Sheets

  • Alphabetize properties (vendor-prefixed properties sorted by their non-prefixed equivalent)
  • Extends and Mixins should be placed before standard properties
  • Use soft tabs with a two space indention
  • Add a space after :
  • Add a space after // comments
  • Add a space after commas in values (e.g. rgba(#000, 0.5))
  • Write numbers at the end of mathematic operations (e.g. $b-space * 0.5)
  • Stick with classes instead of IDs for styling
  • Limit nesting as much as possible
// Example

.component
  @extend .group
  +transition(opacity 0.2s ease-in-out)
  border-radius: 5px
  box-shadow: 0 2px 5px rgba(#000, 0.5)
  -webkit-flex: 1 1 50%
  -ms-flex: 1 1 50%
  flex: 1 1 50%
  font-style: italic
  padding-bottom: $b-space * 3

Markup

  • Alphabetize classes, ordered by Component, Structure, Tool, state, and context
  • Apply modifier classes after each individual module
<div class="g collection collection--1of3 bch mtl tci is-active has-dropdown"></div>
\ No newline at end of file diff --git a/styleguide/comments/index.html b/styleguide/comments/index.html deleted file mode 100644 index 24c7f27..0000000 --- a/styleguide/comments/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Styleguide - Comments / MVCSS
Toggle

Styleguide - Comments

There are four levels of comments, in order of decreasing importance:

// *************************************
//
//   First Level
//   -> Description
//
// *************************************

// -------------------------------------
//   Second Level
// -------------------------------------

// ----- Third Level ----- //

// Fourth Level
\ No newline at end of file diff --git a/styleguide/index.html b/styleguide/index.html deleted file mode 100644 index 692b1d5..0000000 --- a/styleguide/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Styleguide / MVCSS
Toggle

Styleguide

Before diving in, we’ll start with a bit of housekeeping. This section outlines our internal standards for writing CSS (and more specifically, Sass). While you’re certainly welcome to switch it up, these guidelines will help in moving through our examples and base files.

We’re big proponents of the Sass indented syntax (.sass), so things may look slightly different if you’re a Sassy CSS (.scss) fan.

Word of warning: some of the sections herein will be a bit confusing, like Naming Conventions, until seen in context later—an unfortunate chicken/egg situation.

\ No newline at end of file diff --git a/styleguide/naming/index.html b/styleguide/naming/index.html deleted file mode 100644 index fd39775..0000000 --- a/styleguide/naming/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Styleguide - Naming Conventions / MVCSS
Toggle

Styleguide - Naming Conventions

Following ideas pioneered in BEM and SUIT, MVCSS has a strict series of naming conventions that provide context at a glance.

Tools

As you may notice in _tools.sass, many of the Tool classes look pretty acronym-y. We’ll get into the gains inherent with defining Tools shortly, but for now just assume two- or three-letter classes fall under this notion.

A class such as .mbm is a shorthand way to define a basic unit of bottom margin: margin bottom medium. Similarly, .mbl would be the large variety of bottom margin.

Components/Structures

Structures and Components exist as Sass partials in their respective directories, and are always singular. Examples include icon, button, g (grid), form, and modal.

If the name comprises two words, utilize camelCase—for instance, taskList.

Modifiers

After defining the base properties of a Component or Structure, modifiers exist to allow stylistic tweaks that build on the initial definition. These tweaks are denoted with two hyphens --. A button, for instance, might have a number of different colors and sizes:

// *************************************
//
//   Button
//   -> Action points
//
// *************************************

.btn
  border: 0
  display: inline-block
  line-height: 2.5
  padding: 0 $b-space
  font-weight: bold

// -------------------------------------
//   Modifiers
// -------------------------------------

// ----- Sizes ----- //

.btn--s
  font-size: 75%

.btn--l
  font-size: 150%

// ----- Theme ----- //

// Hierarchy

.btn--a
  background: $c-base

.btn--b
  background: $c-highlight

After creation, elements that need a modifier will use the root class (.btn) and any number of modifiers deemed necessary:

<button class="btn btn--a btn--l">A Button</button>

Note: modifiers typically work best when defined in hierarchical sequence (a, b) or via function (cancel, submit) as opposed to look (red, blue).

Shorthand Notation

As you can see above, we’ll use shorthand notation for sizing and hierarchy modifiers. For example, rather than writing btn--large, we’ll write btn--l. We do this for the sake of terseness, but feel free to write out the words, if that’s more comfortable for you and your authors.

Here are the shorthand notation modifier conventions that we use for sizing and hierarchy:

// Sizing
--f  (flush)
--xs (extra small)
--s  (small)
--m  (medium)
--l  (large)
--xl (extra large)

// Hierarchy
--a (primary)
--b (secondary)
--c (tertiary)

Note: If you go past tertiary on the hierarchy scale, you probably need a different modifier, as you have too many levels of hierarchy.

States

Generally added via JavaScript, states are similar to modifiers but carry conditional context. is- denotes a state, such as is-active, and they’re utilized as such:

// *************************************
//
//   Button
//   -> Action points
//
// *************************************

.btn
  // Styles

// Modifiers

// -------------------------------------
//   States
// -------------------------------------

.btn.is-active
  background: $c-highlight

We use is-active as a convention throughout MVCSS, but any state can affect any module in a unique way. For example, applying is-active on an btn may have a completely different effect from applying is-active on a nav-item. By using only compound selectors (.module.is-state) to define state, we’re able to increase specificity when needed, while also containing any changes within a single module’s namespace.

Context

We also borrow the idea of context from SUIT. Modularizing styles into self-contained units works well most of the time, but you’ll occasionally need a parent element to fall in line.

The most common case tends to be positioning context. If you have a dropdown structure that’s being positioned absolutely, the parent element should be (at least) positioned relatively:

// *************************************
//
//   Dropdown
//   -> Revealed information
//
// *************************************

.dropdown
  // Styles

// Modifiers, States

// -------------------------------------
//   Context
// -------------------------------------

.has-dropdown
  position: relative

Similar to is- with states, classes beginning with has- denote a context selector.

Scaffolding

Elements nested within a Component or Structure that need styling based on being there can be added to the scaffolding. Keeping with the dropdown Structure, the scaffold section falls last:

// *************************************
//
//   Dropdown
//   -> Revealed information
//
// *************************************

.dropdown
  // Styles

// Modifiers, States, Context

// -------------------------------------
//   Scaffolding
// -------------------------------------

.dropdown-media
  border: 4px solid $c-invert

For items in scaffolding, the Component/Structure name comes first, followed by a single hyphen and the subcomponent/substructure name (also in camelCase, if necessary). Where applicable, they can have their own modifiers, states, and subcomponents/substructures—more than two levels, though, typically means it’s time to refactor.

// *************************************
//
//   Card
//   -> Individual style containers
//
// *************************************

.card
  background: $c-invert
  border-radius: $b-borderRadius
  box-shadow: $b-boxShadow
  padding: $b-space
  position: relative

// Modifiers, States, Context

// -------------------------------------
//   Scaffolding
// -------------------------------------

// ----- Header ----- //

.card-header
  border-bottom: $b-border
  margin-bottom: $b-space-s
  margin-left: -$b-space
  margin-right: -$b-space
  padding-left: $b-space
  padding-right: $b-space

// Modifiers

.card-header--push
  margin-bottom: $b-space-l

In the card example above, we’ve defined a modifier class that affects the card-header scaffolding item. Applying the class directly to the element descendent of card helps us insert additional space when needed, while also keeping CSS specificity low.

Variables

Variables are a big enough consideration that we dedicate an entire file to keeping them organized. You can find all the information regarding variables in Config.

Images

A section about naming images? I know. Let’s just get through it.

  • bg-* for background images
  • logo-* for logos
  • img-* for content images
  • Sub-folders for larger groups
\ No newline at end of file diff --git a/styleguide/numbers-game/index.html b/styleguide/numbers-game/index.html deleted file mode 100644 index d5db12f..0000000 --- a/styleguide/numbers-game/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Styleguide - The Numbers Game / MVCSS
Toggle

Styleguide - The Numbers Game

As much as possible, we prefer sticking to relative units in a predictable scale. Base values are typically stored in Config (which we’ll cover in Foundation) and derived from that point on. For purposes of efficiency and standardization, you’ll define number values less often than usual in MVCSS.

Approach

  • A pixel value for a base font size (stored in Config) is set on the root html element, thereby preparing both text sizing and the relative value of an em unit
  • Line heights are unitless, e.g. 1.5
  • Spacing (padding, margin, etc.) is a multiple of a stored base space value, set in ems
  • Font sizes (aside from the html element) are defined with percentage values, scaling the other relative properties on the element simultaneously

This setup should be a easier to grasp once we reach the Config, Tools, and Base segments of Foundation.

Note: pixel values will occasionally be required to meet design requirements, especially with things like offsets. Most often, these are considered magic numbers, and you should avoid using them as much as possible.

\ No newline at end of file diff --git a/vendor/index.html b/vendor/index.html deleted file mode 100644 index 05d8d14..0000000 --- a/vendor/index.html +++ /dev/null @@ -1,23 +0,0 @@ - Vendor / MVCSS
Toggle

Vendor

Vendor is where we include all third-party style sheets and is intentionally empty by default.

Vendor may contain unaltered third-party code, as well as refactored modules from other libraries, frameworks, and UI toolkits. To include any .css files, you can change their file extentions to .scss and use @import as you would normally.

If a snippet of code is portable and no larger than a single class, we usually paste these alongside others modules in the Helpers section.

Note: although _reset.sass contains third-party code, we include it inside Foundation. This helps us organize low-level styles and prevent some potential source order dependency issues when authoring CSS.

\ No newline at end of file