Skip to content
This repository was archived by the owner on Dec 11, 2021. It is now read-only.

Initial base typography #57

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ module.exports = function( grunt ) {
require( "load-grunt-tasks" )( grunt );

var config = {
htmllint: {
dist: {
options: {},
src: [ "demos/*.html" ]
}
},
autoprefixer: {
dist: {
options: {
Expand Down Expand Up @@ -44,7 +50,7 @@ var config = {
}
},
csslint: {
src: [ "dist/css/chassis.lint.css", "dist/css/chassis.lint.css" ]
src: [ "dist/css/chassis.lint.css", "dist/css/chassis.lint.css", "demos/demos.css" ]
},
jscs: {
all: [ "*.js", "performance/**/*.js" ]
Expand Down Expand Up @@ -181,7 +187,7 @@ grunt.initConfig( config );
grunt.loadTasks( "tasks" );
grunt.loadNpmTasks( "perfjankie" );
grunt.registerTask( "default", [ "test" ] );
grunt.registerTask( "test", [ "build", "jshint", "jscs", "csslint" ] );
grunt.registerTask( "test", [ "build", "jshint", "jscs", "csslint", "htmllint" ] );
grunt.registerTask( "build", [ "svg", "sass", "csscomb", "cssmin" ] );
grunt.registerTask( "perf", [
"start-selenium-server",
Expand Down
5 changes: 5 additions & 0 deletions demos/demos.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
body {
max-width: 700px;
margin: 3em auto;
padding: 0 1em;
}
150 changes: 150 additions & 0 deletions demos/typography.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Chassis - Typography</title>
<meta name="description" content="Typography skeleton for styling">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../dist/css/chassis.css">
<link rel="stylesheet" href="demos.css">
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700,400italic,700italic" rel="stylesheet">
</head>
<body>

<h1>CSS Chassis</h1>

<hr>

<h1>Heading 1 &lt;h1&gt;</h1>
<h2>Heading 2 &lt;h2&gt;</h2>
<h3>Heading 3 &lt;h3&gt;</h3>
<h4>Heading 4 &lt;h4&gt;</h4>
<h5>Heading 5 &lt;h5&gt;</h5>
<h6>Heading 6 &lt;h6&gt;</h6>

<hr>

<h1>Heading 1 &lt;h1&gt;</h1>
<p>Many say exploration is part of our destiny, but it’s actually our duty to future generations and their quest to ensure the survival of the human species.</p>

<h2>Heading 2 &lt;h2&gt;</h2>
<p>It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn"t feel like a giant. I felt very, very small.</p>

<h3>Heading 3 &lt;h3&gt;</h3>
<p>The Earth was small, light blue, and so touchingly alone, our home that must be defended like a holy relic. The Earth was absolutely round. I believe I never knew what the word round meant until I saw Earth from space.</p>

<h4>Heading 4 &lt;h4&gt;</h4>
<p>To be the first to enter the cosmos, to engage, single-handed, in an unprecedented duel with nature—could one dream of anything more?</p>

<h5>Heading 5 &lt;h5&gt;</h5>
<p>What was most significant about the lunar voyage was not that man set foot on the Moon but that they set eye on the earth.</p>

<h6>Heading 6 &lt;h6&gt;</h6>
<p>Many say exploration is part of our destiny, but it’s actually our duty to future generations and their quest to ensure the survival of the human species.</p>

<hr>

<h2>Block-level elements</h2>

<p>Here"s a paragraph &lt;p&gt; filled with some <a href="http://spaceipsum.com/">Space Ipsum</a>. Never in all their history have men been able truly to conceive of the world as one: a single sphere, a globe, having the qualities of a globe, a round earth in which all the directions eventually meet, in which there is no center because every point, or none, is center — an equal earth which all men occupy as equals. The airman"s earth, if free men make it, will be truly round: a globe in practice, not in theory.</p>

<p>There can be no thought of finishing for ‘aiming for the stars.’ Both figuratively and literally, it is a task to occupy the generations. And no matter how much progress one makes, there is always the thrill of just beginning.</p>

<div>Here"s a div &lt;div&gt;. A Chinese tale tells of some men sent to harm a young girl who, upon seeing her beauty, become her protectors rather than her violators. That"s how I felt seeing the Earth for the first time. I could not help but love and cherish her
</div>

<article>
<h3>This is an article &lt;article&gt; with a paragraph</h3>
<p>We want to explore. We’re curious people. Look back over history, people have put their lives at stake to go out and explore … We believe in what we’re doing. Now it’s time to go.</p>
<p>End of the article.</p>
</article>

<blockquote>Let"s light this fire one more time, Mike, and witness this great nation at its best. &lt;blockquote&gt; via <a href="http://spaceipsum.com/">Space Ipsum</a></blockquote>

<p>We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win.</p>

<pre>
* {
font-family: "Comic Sans MS", "Comic Sans", "Marker Felt" !important;
}
&lt;pre&gt;
</pre>

<p>Many say exploration is part of our destiny, but it’s actually our duty to future generations and their quest to ensure the survival of the human species.</p>

<address>
<strong>Sherlock Holmes</strong><br>
221B Baker Street<br>
London, United Kingdom &lt;address&gt;
</address>

<hr>

<h2>Lists &lt;li&gt;</h2>
<p>The regret on our side is, they used to say years ago, we are reading about you in science class. Now they say, we are reading about you in history class.</p>

<ul>
<li>Unordered list &lt;ul&gt;</li>
<li>List element</li>
<li>Across the sea of space, the stars are other suns.</li>
<li>Science cuts two ways, of course; its products can be used for both good and evil. But there"s no turning back from science. The early warnings about technological dangers also come from science.</li>
</ul>

<p>It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn"t feel like a giant. I felt very, very small.</p>

<ol>
<li>Ordered list &lt;ol&gt;</li>
<li>List element</li>
<li>The dreams of yesterday are the hopes of today and the reality of tomorrow.</li>
<li>Curious that we spend more time congratulating people who have succeeded than encouraging people who have not.</li>
</ol>

<p>For those who have seen the Earth from space, and for the hundreds and perhaps thousands more who will, the experience most certainly changes your perspective. The things that we share in our world are far more valuable than those which divide us.</p>

<dl>
<dt>Definition term &lt;dt&gt;</dt>
<dd>Definition &lt;dd&gt;</dd>
<dt>Earth</dt>
<dd>A kick-ass planet.</dd>
<dt>Pluto</dt>
<dd>A kick-ass former planet.</dd>
<dt>Space Ipsum</dt>
<dd>NASA is not about the ‘Adventure of Human Space Exploration’…We won’t be doing it just to get out there in space – we’ll be doing it because the things we learn out there will be making life better for a lot of people who won’t be able to go.</dd>
</dl>

<p>Spaceflights cannot be stopped. This is not the work of any one man or even a group of men. It is a historical process which mankind is carrying out in accordance with the natural laws of human development.</p>

<hr>

<h2>Text-level elements</h2>

<ul>
<li><a href="#">anchor link</a> &lt;a&gt;</li>
<li>abbreviation: <abbr title="Syntactically Awesome Stylesheets">SASS</abbr> &lt;abbr&gt;</li>
<li>citation: <cite>A Study in Scarlet</cite> &lt;cite&gt;</li>
<li>Here"s the <code>&lt;code&gt;</code> element</li>
<li>deleted text: <del>Episodes I, II, III</del> &lt;del&gt;</li>
<li>definition: The <dfn>definition element</dfn> is the element being defined inline. &lt;dfn&gt;</li>
<li><em>emphasis</em> &lt;em&gt;</li>
<li><ins>inserted text</ins> &lt;ins&gt;</li>
<li>keyboard input: <kbd>control + space</kbd> &lt;kbd&gt;</li>
<li><mark>mark element</mark> &lt;mark&gt;</li>
<li>meter: <meter min="200" max="500" value="423">awesomeness</meter> &lt;meter&gt;</li>
<li>progress: <progress value="90" max="100">70 %</progress> &lt;progress&gt;</li>
<li>quotation (short): <q>You just gotta believe!</q> &lt;q&gt;</li>
<li>quotation within a quotation (short): <q>Yo dawg, I heard you like quotes so I put <q>this quote</q> within this quote.</q> &lt;q&gt;</li>
<li>strikethough: <s>Lance Armstrong remains steroid-free.</s> &lt;s&gt;</li>
<li>sample text: <samp>Error</samp> &lt;samp&gt;</li>
<li>small: <small>Hydrogen</small> &lt;small&gt;</li>
<li>small within small: <small>Hydrogen <small>Hydrogen</small></small> &lt;small&gt;</li>
<li>strong: <strong>The Hammer</strong> &lt;strong&gt;</li>
<li>subscript: <sub>Lower</sub> 0<sub>1<sub>2<sub>3</sub></sub></sub> &lt;sub&gt;</li>
<li>superscript: I need a good <sup>superman</sup> joke to go here. 0<sup>1<sup>2<sup>3</sup></sup></sup> &lt;sup&gt;</li>
<li>time: <time datetime="1985-12-09 19:00">Dec 9</time> &lt;time&gt;</li>
<li>underline: Never underline <u>anything</u>. &lt;u&gt;</li>
<li>variable: <var>cat</var> + <var>dog</var> = <var>catdog</var> &lt;var&gt;</li>
</ul>
<hr>

</body>
</html>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"grunt-csscomb": "3.0.0",
"grunt-git-authors": "2.0.0",
"grunt-html": "1.6.0",
"grunt-htmllint": "0.2.7",
"grunt-jscs": "0.6.2",
"grunt-npmcopy": "0.1.0",
"grunt-sass": "0.18.1",
Expand Down
26 changes: 26 additions & 0 deletions scss/atoms/typography/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ==========================================================================
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry i didn't notice the before but the style guide mandates /* comment */ style comments since these are the only valid style in normal css. @MichaelArestad can you please switch all the comments here to use this style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using multiline comments the plan for the Sass guide?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realize this style has slipped in already in other files, we should switch these to match the style guide in a separate PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichaelArestad well its not necessarily multi line it the only valid style in normal css. I personally don't think its good practice to use different comment styles in different files so we should stick to valid css comments i don't think using // has any benefit over /* */ other then not typing 2 chars which git stripped out in real build anyway i think clarity and consistency should prevail here. @sfrisk what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are minor benefits which are situational. No single line comments end up in output CSS files whereas multiline comments do depending on output style. This is handy for when you want to comment things like functions without it ending up in the output code or when you are generating a theme file and want to curate which comments end up in the compiled CSS file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No single line comments end up in output CSS files whereas multiline comments do depending on output style

So no comments at all end up in minified files which is really what matter. We also use the "Expanded" style which outputs both single and multi line comments so there is no difference here either.

This is handy for when you want to comment things like functions without it ending up in the output code or when you are generating a theme file and want to curate which comments end up in the compiled CSS file.

This would be true if our output style accommodated this however it does not. Only the compressed output style accommodates this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expanded does not output single line comments. No style does.

Compressed, expanded, and nested support outputting multiline comments (without doing a forced comment /*! */).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichaelArestad Your right sorry i looked this up and misread. You are correct here.

So in this case there is basically one major case that makes sense to use single line comments which is where we have a comment that would end up with no context and make no sense if it ended up in an uncompressed output file. This would likely be the case for most functions. Most other places should probably stick to multiline i think still. Since we have both css and scss files in this repo i would like to try to keep things as clear and consistent as possible. Also i think anything that deserved a comment in the scss file should still have one in the uncompressed development build file.

@MichaelArestad how does that sound to you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Probably functions and comments that are implementation instructions for mixins as well. Will change on another PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably functions and comments that are implementation instructions for mixins as well.

I think a general rule of "will this lose context when its in the built file" could apply for what should use single line.

On a slight aside these sorts of comments in these 2 cases should probably eventually move to the documentation ( once such a thing exists ) but for now yes i agree.

// Typography functions
// ==========================================================================

// Adds a single pixel underline (so nice) on retina
// Usage: `@include slime-underline;`
@mixin slim-underline() {
text-decoration: none;
background-image: linear-gradient( to bottom, rgba( 0, 0, 0, 0 ) 75%, #000 50% );
background-repeat: repeat-x;
background-size: 2px 2px;
background-position: 0 em( 22px );

&:hover,
&:active,
&:focus {
background-size: 2px 6px;
background-position: 0 em( 18px );
}
@media not all,
only screen and ( min-resolution: 2dppx ),
only screen and ( -webkit-min-device-pixel-ratio: 2 ) {
background-image: linear-gradient( to bottom, rgba( 0, 0, 0, 0 ) 75%, #000 75% );
background-repeat: repeat-x;
}
}
121 changes: 120 additions & 1 deletion scss/atoms/typography/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,123 @@

@import
"variables",
"functions";
"functions",
"mixins";

body {
font: $normal #{ map-get( $root-font, font-size ) }/1.5 $sans-serif;

@media ( max-width: 800px ) {
font-size: 16px;
}
@media ( max-width: 500px ) {
font-size: 14px;
}
}

h1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heading elements should only be defined once.

font-size: em( 67px ); // 54px works nicely, as well
font-weight: 700;
line-height: 1;
}

h2 {
font-size: em( 36px );
font-weight: 600;
line-height: 1;
}

h3 {
font-size: em( 30px );
font-weight: 600;
line-height: 1;
}

h4 {
font-size: em( 24px );
font-weight: 600;
line-height: 1;
}

h5 {
font-size: em( 20px );
font-weight: 600;
line-height: 1;
}

h6 {
font-size: em( 16px );
font-weight: 600;
line-height: 1;
text-transform: uppercase;
}

// ==========================================================================
// Block elements
// ==========================================================================

hr {
border: 0;
border-bottom: 1px solid #999;
}

blockquote {
margin: 0;
padding-left: 1em;
position: relative;
border-left: 4px solid #eee; // TODO replace with color variable
font-style: italic;
}

pre {
padding: 16px 20px;
background: #f7f7f7;
font: normal 12px/1.4 $monospace;
}

// ==========================================================================
// Lists
// ==========================================================================

dt {
font-weight: 600;
}

dd {
margin: 0;
}

// ==========================================================================
// Inline elements
// ==========================================================================

a {
//TODO add colors

&:hover,
&:active,
&:focus {
//TODO add colors
}
&:visited {
// TODO add colors
}
}

p > a {
// Good example of slim underline. We'll want to use this on body copy/quotes
color: inherit;
@include slim-underline;
}

b,
strong {
font-weight: $bold;
}

code {
background: #f2f2f2; // TODO replace with color variable
font-size: em( 16px );
padding: em( 4px, 16px ) em( 8px, 16px );
border-radius: 3px;
}
2 changes: 1 addition & 1 deletion scss/atoms/typography/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ $root-font: (
// Typefaces
$monospace: "courier new", monospace;
$serif: Georgia, "Times New Roman", Times, serif;
$sans: Helvetica, Arial, sans-serif;
$sans-serif: "Source Sans Pro", Helvetica, Arial, sans-serif;