From 18881e6d7a8f5f2f3396c4f95cf37949aa15f305 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 25 Sep 2014 21:33:10 -0700 Subject: [PATCH] Change up all the things to do Sass support --- .gitignore | 1 + README.md | 7 +- _config.yml | 7 + _includes/head.html | 3 +- _scss/base.scss | 73 ++++ _scss/code.scss | 66 ++++ _scss/layout.scss | 15 + _scss/masthead.scss | 26 ++ _scss/message.scss | 11 + _scss/pagination.scss | 52 +++ _scss/posts.scss | 61 +++ public/css/syntax.css => _scss/syntax.scss | 0 _scss/type.scss | 97 +++++ css/styles.scss | 28 ++ public/css/poole.css | 430 --------------------- 15 files changed, 442 insertions(+), 435 deletions(-) create mode 100644 _scss/base.scss create mode 100644 _scss/code.scss create mode 100644 _scss/layout.scss create mode 100644 _scss/masthead.scss create mode 100644 _scss/message.scss create mode 100644 _scss/pagination.scss create mode 100644 _scss/posts.scss rename public/css/syntax.css => _scss/syntax.scss (100%) create mode 100644 _scss/type.scss create mode 100644 css/styles.scss delete mode 100644 public/css/poole.css diff --git a/.gitignore b/.gitignore index 10c58cf..33c0adb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ _gh_pages _site .ruby-version +.sass-cache # Numerous always-ignore extensions *.diff diff --git a/README.md b/README.md index 1e5626a..d470c87 100644 --- a/README.md +++ b/README.md @@ -30,17 +30,18 @@ Individual theme feedback and bug reports should be submitted to the theme's ind ## Usage -### 1. Install Jekyll +### 1. Install dependencies -Poole is built for use with Jekyll, so naturally you'll need to install that. On Macs, it's rather straightforward: +Poole is built on Jekyll and uses SCSS instead of vanilla CSS. Before getting started, you'll need to install their gems: ```bash $ gem install jekyll +$ gem install scss ``` **Windows users:** Windows users have a bit more work to do, but luckily [@juthilo](https://github.com/juthilo) has your back with his [Run Jekyll on Windows](https://github.com/juthilo/run-jekyll-on-windows) guide. -You may also need to install Pygments, the Python syntax highlighter for code snippets that plays nicely with Jekyll. Read more about this [in the Jekyll docs](http://jekyllrb.com/docs/templates/#code_snippet_highlighting). +**Need syntax highlighting?** Poole includes support for Pygments or Rouge, so install your gem of choice to make use of the built-in styling. Read more about this [in the Jekyll docs](http://jekyllrb.com/docs/templates/#code_snippet_highlighting). ### 2a. Quick start diff --git a/_config.yml b/_config.yml index 482d84c..30929c2 100644 --- a/_config.yml +++ b/_config.yml @@ -15,6 +15,13 @@ url: http://getpoole.com paginate: 1 baseurl: / +# Assets +# +# We specify the directory for Jekyll so we can use @imports. +sass: + sass_dir: _scss + style: :compressed + # About/contact author: name: Mark Otto diff --git a/_includes/head.html b/_includes/head.html index 71acc25..8962bbb 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -14,8 +14,7 @@ - - + diff --git a/_scss/base.scss b/_scss/base.scss new file mode 100644 index 0000000..df8b5d0 --- /dev/null +++ b/_scss/base.scss @@ -0,0 +1,73 @@ +// Body resets +// +// Update the foundational and global aspects of the page. + +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +html, +body { + margin: 0; + padding: 0; +} + +html { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 1.5; + + @media (min-width: 38em) { + font-size: 20px; + } +} + +body { + color: #515151; + background-color: #fff; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +// No `:visited` state is required by default (browsers will use `a`) +a { + color: #268bd2; + text-decoration: none; + + // `:focus` is linked to `:hover` for basic accessibility + &:hover, + &:focus { + text-decoration: underline; + } + + strong { + color: inherit; + } +} + +// Images +img { + display: block; + max-width: 100%; + margin: 0 0 1rem; + border-radius: 5px; +} + +// Tables +table { + margin-bottom: 1rem; + width: 100%; + border: 1px solid #e5e5e5; + border-collapse: collapse; +} +td, +th { + padding: .25rem .5rem; + border: 1px solid #e5e5e5; +} +tbody tr:nth-child(odd) td, +tbody tr:nth-child(odd) th { + background-color: #f9f9f9; +} diff --git a/_scss/code.scss b/_scss/code.scss new file mode 100644 index 0000000..328ea75 --- /dev/null +++ b/_scss/code.scss @@ -0,0 +1,66 @@ +// Code +// +// Inline and block-level code snippets. Includes tweaks to syntax highlighted +// snippets from Pygments/Rouge and Gist embeds. + +code, +pre { + font-family: Menlo, Monaco, "Courier New", monospace; +} +code { + padding: .25em .5em; + font-size: 85%; + color: #bf616a; + background-color: #f9f9f9; + border-radius: 3px; +} +pre { + display: block; + margin-top: 0; + margin-bottom: 1rem; + padding: 1rem; + font-size: .8rem; + line-height: 1.4; + white-space: pre; + white-space: pre-wrap; + word-break: break-all; + // word-wrap: break-word; + background-color: #f9f9f9; +} +pre code { + padding: 0; + font-size: 100%; + color: inherit; + background-color: transparent; +} + +// Pygments via Jekyll +.highlight { + margin-bottom: 1rem; + border-radius: 4px; +} +.highlight pre { + margin-bottom: 0; +} + +// Gist via GitHub Pages +.gist .gist-file { + font-family: Menlo, Monaco, "Courier New", monospace !important; +} +.gist .markdown-body { + padding: 15px; +} +.gist pre { + padding: 0; + background-color: transparent; +} +.gist .gist-file .gist-data { + font-size: .8rem !important; + line-height: 1.4; +} +.gist code { + padding: 0; + color: inherit; + background-color: transparent; + border-radius: 0; +} diff --git a/_scss/layout.scss b/_scss/layout.scss new file mode 100644 index 0000000..2a27269 --- /dev/null +++ b/_scss/layout.scss @@ -0,0 +1,15 @@ +// Layout +// +// Styles for managing the structural hierarchy of the site. + +.container { + max-width: 38rem; + padding-left: 1.5rem; + padding-right: 1.5rem; + margin-left: auto; + margin-right: auto; +} + +footer { + margin-bottom: 2rem; +} diff --git a/_scss/masthead.scss b/_scss/masthead.scss new file mode 100644 index 0000000..34306f5 --- /dev/null +++ b/_scss/masthead.scss @@ -0,0 +1,26 @@ +// Masthead +// +// Super small header above the content for site name and short description. + +.masthead { + padding-top: 1rem; + padding-bottom: 1rem; + margin-bottom: 3rem; +} + +.masthead-title { + margin-top: 0; + margin-bottom: 0; + color: #505050; + + a { + color: #505050; + } + + small { + font-size: 75%; + font-weight: 400; + color: #c0c0c0; + letter-spacing: 0; + } +} diff --git a/_scss/message.scss b/_scss/message.scss new file mode 100644 index 0000000..42bf2e5 --- /dev/null +++ b/_scss/message.scss @@ -0,0 +1,11 @@ +// Messages +// +// Show alert messages to users. You may add it to single elements like a `

`, +// or to a parent if there are multiple elements to show. + +.message { + margin-bottom: 1rem; + padding: 1rem; + color: #717171; + background-color: #f9f9f9; +} diff --git a/_scss/pagination.scss b/_scss/pagination.scss new file mode 100644 index 0000000..4308134 --- /dev/null +++ b/_scss/pagination.scss @@ -0,0 +1,52 @@ +// Pagination +// +// Super lightweight (HTML-wise) blog pagination. `span`s are provide for when +// there are no more previous or next posts to show. + +.pagination { + overflow: hidden; // clearfix + margin: 0 -1.5rem 1rem; + font-family: "PT Sans", Helvetica, Arial, sans-serif; + color: #ccc; + text-align: center; +} + +// Pagination items can be `span`s or `a`s +.pagination-item { + display: block; + padding: 1rem; + border: solid #eee; + border-width: 1px 0; + + &:first-child { + margin-bottom: -1px; + } +} + +// Only provide a hover state for linked pagination items +a.pagination-item:hover { + background-color: #f5f5f5; +} + +@media (min-width: 30em) { + .pagination { + margin: 3rem 0; + } + + .pagination-item { + float: left; + width: 50%; + border-width: 1px; + + &:first-child { + margin-bottom: 0; + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + } + &:last-child { + margin-left: -1px; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + } + } +} diff --git a/_scss/posts.scss b/_scss/posts.scss new file mode 100644 index 0000000..5acf278 --- /dev/null +++ b/_scss/posts.scss @@ -0,0 +1,61 @@ +// Posts and pages +// +// Each post is wrapped in `.post` and is used on default and post layouts. Each +// page is wrapped in `.page` and is only used on the page layout. + +.page, +.post { + margin-bottom: 4em; +} + +// Blog post or page title +.page-title, +.post-title, +.post-title a { + color: #303030; +} +.page-title, +.post-title { + margin-top: 0; +} + +// Meta data line below post title +.post-date { + display: block; + margin-top: -.5rem; + margin-bottom: 1rem; + color: #9a9a9a; +} + + +// Related posts +.related { + padding-top: 2rem; + padding-bottom: 2rem; + border-top: 1px solid #eee; +} + +.related-posts { + padding-left: 0; + list-style: none; + + h3 { + margin-top: 0; + } + + li { + small { + font-size: 75%; + color: #999; + } + + a:hover { + color: #268bd2; + text-decoration: none; + + small { + color: inherit; + } + } + } +} diff --git a/public/css/syntax.css b/_scss/syntax.scss similarity index 100% rename from public/css/syntax.css rename to _scss/syntax.scss diff --git a/_scss/type.scss b/_scss/type.scss new file mode 100644 index 0000000..90699f0 --- /dev/null +++ b/_scss/type.scss @@ -0,0 +1,97 @@ +// Typography +// +// Headings, body text, lists, and other misc typographic elements. + +// Headings +h1, h2, h3, h4, h5, h6 { + margin-bottom: .5rem; + font-weight: bold; + line-height: 1.25; + color: #313131; + text-rendering: optimizeLegibility; +} +h1 { + font-size: 2rem; +} +h2 { + margin-top: 1rem; + font-size: 1.5rem; +} +h3 { + margin-top: 1.5rem; + font-size: 1.25rem; +} +h4, h5, h6 { + margin-top: 1rem; + font-size: 1rem; +} + +// Body text +p { + margin-top: 0; + margin-bottom: 1rem; +} + +strong { + color: #303030; +} + +// Lists +ul, ol, dl { + margin-top: 0; + margin-bottom: 1rem; +} + +dt { + font-weight: bold; +} +dd { + margin-bottom: .5rem; +} + +// Misc +hr { + position: relative; + margin: 1.5rem 0; + border: 0; + border-top: 1px solid #eee; + border-bottom: 1px solid #fff; +} + +abbr { + font-size: 85%; + font-weight: bold; + color: #555; + text-transform: uppercase; +} +abbr[title] { + cursor: help; + border-bottom: 1px dotted #e5e5e5; +} + +/* Quotes */ +blockquote { + padding: .5rem 1rem; + margin: .8rem 0; + color: #7a7a7a; + border-left: .25rem solid #e5e5e5; + + @media (min-width: 30em) { + padding-right: 5rem; + padding-left: 1.25rem; + } +} + +blockquote p:last-child { + margin-bottom: 0; +} + + +// Custom type +// +// Extend paragraphs with `.lead` for larger introductory text. + +.lead { + font-size: 1.25rem; + font-weight: 300; +} diff --git a/css/styles.scss b/css/styles.scss new file mode 100644 index 0000000..0825f63 --- /dev/null +++ b/css/styles.scss @@ -0,0 +1,28 @@ +--- +# Use a comment to ensure Jekyll reads the file to be transformed into CSS later +# only main files contain this front matter, not partials. +--- + +// +// ___ +// /\_ \ +// _____ ___ ___\//\ \ __ +// /\ '__`\ / __`\ / __`\\ \ \ /'__`\ +// \ \ \_\ \/\ \_\ \/\ \_\ \\_\ \_/\ __/ +// \ \ ,__/\ \____/\ \____//\____\ \____\ +// \ \ \/ \/___/ \/___/ \/____/\/____/ +// \ \_\ +// \/_/ +// +// Designed, built, and released under MIT license by @mdo. Learn more at +// https://github.com/poole/poole. + +@import "base"; +@import "type"; +@import "syntax"; +@import "code"; +@import "layout"; +@import "masthead"; +@import "posts"; +@import "pagination"; +@import "message"; diff --git a/public/css/poole.css b/public/css/poole.css deleted file mode 100644 index 8ec27e7..0000000 --- a/public/css/poole.css +++ /dev/null @@ -1,430 +0,0 @@ -/* - * ___ - * /\_ \ - * _____ ___ ___\//\ \ __ - * /\ '__`\ / __`\ / __`\\ \ \ /'__`\ - * \ \ \_\ \/\ \_\ \/\ \_\ \\_\ \_/\ __/ - * \ \ ,__/\ \____/\ \____//\____\ \____\ - * \ \ \/ \/___/ \/___/ \/____/\/____/ - * \ \_\ - * \/_/ - * - * Designed, built, and released under MIT license by @mdo. Learn more at - * https://github.com/poole/poole. - */ - - -/* - * Contents - * - * Body resets - * Custom type - * Messages - * Container - * Masthead - * Posts and pages - * Pagination - * Reverse layout - * Themes - */ - - -/* - * Body resets - * - * Update the foundational and global aspects of the page. - */ - -* { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -html, -body { - margin: 0; - padding: 0; -} - -html { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 1.5; -} -@media (min-width: 38em) { - html { - font-size: 20px; - } -} - -body { - color: #515151; - background-color: #fff; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; -} - -/* No `:visited` state is required by default (browsers will use `a`) */ -a { - color: #268bd2; - text-decoration: none; -} -a strong { - color: inherit; -} -/* `:focus` is linked to `:hover` for basic accessibility */ -a:hover, -a:focus { - text-decoration: underline; -} - -/* Headings */ -h1, h2, h3, h4, h5, h6 { - margin-bottom: .5rem; - font-weight: bold; - line-height: 1.25; - color: #313131; - text-rendering: optimizeLegibility; -} -h1 { - font-size: 2rem; -} -h2 { - margin-top: 1rem; - font-size: 1.5rem; -} -h3 { - margin-top: 1.5rem; - font-size: 1.25rem; -} -h4, h5, h6 { - margin-top: 1rem; - font-size: 1rem; -} - -/* Body text */ -p { - margin-top: 0; - margin-bottom: 1rem; -} - -strong { - color: #303030; -} - - -/* Lists */ -ul, ol, dl { - margin-top: 0; - margin-bottom: 1rem; -} - -dt { - font-weight: bold; -} -dd { - margin-bottom: .5rem; -} - -/* Misc */ -hr { - position: relative; - margin: 1.5rem 0; - border: 0; - border-top: 1px solid #eee; - border-bottom: 1px solid #fff; -} - -abbr { - font-size: 85%; - font-weight: bold; - color: #555; - text-transform: uppercase; -} -abbr[title] { - cursor: help; - border-bottom: 1px dotted #e5e5e5; -} - -/* Code */ -code, -pre { - font-family: Menlo, Monaco, "Courier New", monospace; -} -code { - padding: .25em .5em; - font-size: 85%; - color: #bf616a; - background-color: #f9f9f9; - border-radius: 3px; -} -pre { - display: block; - margin-top: 0; - margin-bottom: 1rem; - padding: 1rem; - font-size: .8rem; - line-height: 1.4; - white-space: pre; - white-space: pre-wrap; - word-break: break-all; - word-wrap: break-word; - background-color: #f9f9f9; -} -pre code { - padding: 0; - font-size: 100%; - color: inherit; - background-color: transparent; -} - -/* Pygments via Jekyll */ -.highlight { - margin-bottom: 1rem; - border-radius: 4px; -} -.highlight pre { - margin-bottom: 0; -} - -/* Gist via GitHub Pages */ -.gist .gist-file { - font-family: Menlo, Monaco, "Courier New", monospace !important; -} -.gist .markdown-body { - padding: 15px; -} -.gist pre { - padding: 0; - background-color: transparent; -} -.gist .gist-file .gist-data { - font-size: .8rem !important; - line-height: 1.4; -} -.gist code { - padding: 0; - color: inherit; - background-color: transparent; - border-radius: 0; -} - -/* Quotes */ -blockquote { - padding: .5rem 1rem; - margin: .8rem 0; - color: #7a7a7a; - border-left: .25rem solid #e5e5e5; -} -blockquote p:last-child { - margin-bottom: 0; -} -@media (min-width: 30em) { - blockquote { - padding-right: 5rem; - padding-left: 1.25rem; - } -} - -img { - display: block; - max-width: 100%; - margin: 0 0 1rem; - border-radius: 5px; -} - -/* Tables */ -table { - margin-bottom: 1rem; - width: 100%; - border: 1px solid #e5e5e5; - border-collapse: collapse; -} -td, -th { - padding: .25rem .5rem; - border: 1px solid #e5e5e5; -} -tbody tr:nth-child(odd) td, -tbody tr:nth-child(odd) th { - background-color: #f9f9f9; -} - - -/* - * Custom type - * - * Extend paragraphs with `.lead` for larger introductory text. - */ - -.lead { - font-size: 1.25rem; - font-weight: 300; -} - - -/* - * Messages - * - * Show alert messages to users. You may add it to single elements like a `

`, - * or to a parent if there are multiple elements to show. - */ - -.message { - margin-bottom: 1rem; - padding: 1rem; - color: #717171; - background-color: #f9f9f9; -} - - -/* - * Container - * - * Center the page content. - */ - -.container { - max-width: 38rem; - padding-left: 1rem; - padding-right: 1rem; - margin-left: auto; - margin-right: auto; -} - - -/* - * Masthead - * - * Super small header above the content for site name and short description. - */ - -.masthead { - padding-top: 1rem; - padding-bottom: 1rem; - margin-bottom: 3rem; -} -.masthead-title { - margin-top: 0; - margin-bottom: 0; - color: #505050; -} -.masthead-title a { - color: #505050; -} -.masthead-title small { - font-size: 75%; - font-weight: 400; - color: #c0c0c0; - letter-spacing: 0; -} - - -/* - * Posts and pages - * - * Each post is wrapped in `.post` and is used on default and post layouts. Each - * page is wrapped in `.page` and is only used on the page layout. - */ - -.page, -.post { - margin-bottom: 4em; -} - -/* Blog post or page title */ -.page-title, -.post-title, -.post-title a { - color: #303030; -} -.page-title, -.post-title { - margin-top: 0; -} - -/* Meta data line below post title */ -.post-date { - display: block; - margin-top: -.5rem; - margin-bottom: 1rem; - color: #9a9a9a; -} - -/* Related posts */ -.related { - padding-top: 2rem; - padding-bottom: 2rem; - border-top: 1px solid #eee; -} -.related-posts { - padding-left: 0; - list-style: none; -} -.related-posts h3 { - margin-top: 0; -} -.related-posts li small { - font-size: 75%; - color: #999; -} -.related-posts li a:hover { - color: #268bd2; - text-decoration: none; -} -.related-posts li a:hover small { - color: inherit; -} - - -/* - * Pagination - * - * Super lightweight (HTML-wise) blog pagination. `span`s are provide for when - * there are no more previous or next posts to show. - */ - -.pagination { - overflow: hidden; /* clearfix */ - margin-left: -1rem; - margin-right: -1rem; - font-family: "PT Sans", Helvetica, Arial, sans-serif; - color: #ccc; - text-align: center; -} - -/* Pagination items can be `span`s or `a`s */ -.pagination-item { - display: block; - padding: 1rem; - border: 1px solid #eee; -} -.pagination-item:first-child { - margin-bottom: -1px; -} - -/* Only provide a hover state for linked pagination items */ -a.pagination-item:hover { - background-color: #f5f5f5; -} - -@media (min-width: 30em) { - .pagination { - margin: 3rem 0; - } - .pagination-item { - float: left; - width: 50%; - } - .pagination-item:first-child { - margin-bottom: 0; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; - } - .pagination-item:last-child { - margin-left: -1px; - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; - } -} -- 2.30.2