forked from marcysutton/gdi-sass
-
Notifications
You must be signed in to change notification settings - Fork 1
/
class1.html
748 lines (664 loc) · 27.9 KB
/
class1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class 1 - Intro to Sass, Girl Develop It</title>
<meta name="description" content="This is the official Girl Develop It Intro to Sass course.
The course is meant to be taught in 2 two-hour sections. Each of the slides and practice files are customizable according to the needs of a given class or audience.">
<meta name="author" content="Girl Develop It">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="icon" type="image/png" href="reveal.js/favicon.ico">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/simple.css" id="theme">
<!-- For syntax highlighting -->
<!-- light editor<link rel="stylesheet" href="lib/css/light.css">-->
<!-- dark editor--><link rel="stylesheet" href="lib/css/dark.css">
<link rel="stylesheet" href="lib/css/zenburn.css">
<link rel="stylesheet" href="plugin/accessibility-helper/css/accessibility-helper.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<!-- Opening slide -->
<section>
<img src="img/gdi_logo_badge.png"alt="Girl Develop It" style="max-height:300px;">
<h1>Intro to Sass</h2>
<h2>Class 1</h2>
</section>
<!-- Opening slide -->
<section>
<h2>Download Class 1 Files:</h2>
<p><a href="http://gdiseattle.github.io/gdi-sass/class1-exercises.zip">http://gdiseattle.github.io/gdi-sass/class1-exercises.zip</a></p>
</section>
<!-- Welcome-->
<section>
<h3>Welcome!</h3>
<div>
<p>Girl Develop It is here to provide affordable and accessible programs to learn software through mentorship and hands-on instruction.</p>
<p class ="green">Some "rules"</p>
<ul>
<li>We are here for you!</li>
<li>Every question is important</li>
<li>Help each other</li>
<li>Have fun</li>
</ul>
</div>
</section>
<section>
<h3>Welcome!</h3>
<div>
<p class="blue">Tell us about yourself.</p>
<ul>
<li>Who are you?</li>
<li>What do you hope to get out of the class?</li>
<li>Unlimited money: where would you travel to?</li>
</ul>
</div>
</section>
<!--What does Sass do? -->
<section>
<h3>What does Sass do?</h3>
<div>
Variables:
<pre><code contenteditable class="sass css">$brandColor: #f90000;
$accentColor: #fff;
header {
background-color: $brandColor;
color: $accentColor;
}
header a { color: $accentColor; }</code></pre>
</div>
</section>
<!--What does Sass do 2? -->
<section>
<h3>What does Sass do?</h3>
<div>
Nesting:
<pre><code contenteditable class="sass css">header {
background-color: $brandColor;
color: $accentColor;
a {
color: $accentColor;
}
}</code></pre>
</div>
</section>
<!--What does Sass do 3? -->
<section>
<h3>What does Sass do?</h3>
<div>
Extends:
<pre><code contenteditable class="sass css">%visually-hidden {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
.image-replace {
@extend %visually-hidden;
background: url(logo.png) no-repeat;
}
</code></pre>
</div>
</section>
<!-- Tools -->
<section>
<h3>Tools</h3>
<ul>
<li>
<div><span class="green">Browser:</span> Chrome or Firefox</div>
</li>
<li>
<span class="green">Development Toolkit:</span> Chrome Inspector or Firebug for Firefox</li>
<li><span class="green">Command Line</span>
<ul>
<li>Terminal for Mac (Find in Applications> Utilities)</li>
<li>Git for Windows (<a target="_blank" href="https://openhatch.org/missions/windows-setup/install-git-bash">see how to install</a>)
</li>
</ul>
</li>
<li>
<div class="green">Text Editor:</div>
<div><a target="_blank" href="http://www.sublimetext.com/2">Sublime Text - Mac or Windows</a><br>
<a target="_blank" href="http://www.sublimetext.com/2">sublimetext.com/2</a></div>
</li>
</ul>
</section>
<!-- Terms-->
<section>
<h3>Terms</h3>
<ul>
<li>
<div><span class="green">Ruby:</span> A programming language</div><br>
</li>
<li>
<div><span class="green">Preprocessor:</span> A computer program that modifies data to conform with the input requirements of another program.
<span class ="blue">(Sass is a preprocessor)</span></div><br>
</li>
<li>
<div><span class="green">Compile:</span> The act of converting one computer program into another programming language.</div><br>
</li>
<li>
<div><span class="green">CSS3:</span> The output of Sass. Sass compiles into CSS!</div>
</li>
</ul>
</section>
<!-- Process: Sass to CSS -->
<section>
<h3>Sass and CSS</h3>
<p>How Sass compiles into CSS</p>
<img src="img/sass-compile.png"/>
<div class="left-align">1. You write Sass (.scss or .sass files)<br>
2 .You run a command (sass --watch) on the command line <br>
3. .scss or .sass files compile into .css files</div>
</section>
<!-- Practice: Command Line -->
<section>
<h3>Command Line Tips</h3>
<div class="left-align">
Up one level:
<pre><code contenteditable class="command-line"><span class="variable">$</span> cd ../</code></pre>
Go to your home directory:
<pre><code contenteditable class="command-line"><span class="variable">$</span> cd /</code></pre>
Go to a specific folder:
<pre><code contenteditable class="command-line"><span class="variable">$</span> <span class="identifier">cd Users/marcy/Sites/gdi-sass</span></pre></code>
List files in a directory:
<pre><code contenteditable class="command-line">$ ls</pre></code>
</div>
<span class="blue left-align"><a target="_blank" href="http://files.fosswire.com/2007/08/fwunixref.pdf">Command Line Cheat Sheet</a></span>
</section>
<!-- Install Sass -->
<section>
<h3>Installing Sass</h3>
<div class="left-align">First, we need to install Ruby:
<ul>
<li>Download for Windows: <a target="_blank" href="http://rubyinstaller.org/">rubyinstaller.org</a></li>
<li>Mac users: you're in luck! Mac OS X comes pre-installed with Ruby. Try the following command in Terminal to make sure: </li>
</ul>
<pre><code contenteditable class ="command-line">ruby -v</code></pre>
</div>
</section>
<!-- Variables-->
<section>
<h3>Installing Sass</h3>
<div class=" left-align">
<p>Now that Ruby is installed, we can install the Sass gem.</p>
<p>In Terminal or Git Bash:</p>
<pre><code contenteditable class ="command-line">gem install sass</code></pre>
</div>
<p class="fragment"><img src="img/confetti.gif" style="border: 0; width: 600px; height: 300px; box-shadow: none;"></p>
</section>
<section>
<h3>Setting up our stylesheets</h3>
<div>
<p>We need to structure our stylesheets before we can compile them.</p>
<ul>
<li>open the <span class="blue">"class1-exercises"</span> folder</li>
<li>open the <span class="blue">"practice"</span> folder in Sublime Text</li>
<li>go ahead and open <a href="class1-exercises/practice/index.html" target="_blank">index.html</a> in a browser</li>
</ul>
</div>
</section>
<section>
<h3>Setting up our stylesheets</h3>
<div class="left-align">
<ul>
<li>rename CSS files to have a <span class="blue"><strong>.scss</strong></span> file extension</li>
<li>structure them inside the stylesheets folder like so:
<ul>
<li>/stylesheets/
<ul>
<li>/css/
<ul>
<li>empty for now</li>
</ul>
</li>
<li>/scss/
<ul>
<li>/font/</li>
<li>reset.scss</li>
<li>styles.scss</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Update your index.html stylesheet url in <head> to point to your /css/ folder.</li>
</ul>
</div>
</section>
<!-- Sass Watch - Compiling -->
<section>
<h3>Compile with the Sass Watch Command</h3>
<div class="left-align">
<p>Check out your index.html file in a browser. Looks funky, yes?</p>
<p class="fragment">We need to compile our .scss (Sass) files to make the CSS work in the browser.</p>
<p class="fragment">First, navigate via the command line to your /stylesheets directory in the "practice" folder.</p>
<p class="fragment">Then type:</p>
<pre class="fragment"><code contenteditable class ="sass css">$ sass --watch scss:css</code></pre>
</div>
</section>
<!-- Sass Watch - Compiling -->
<section>
<h3>Compile with the Sass Watch Command</h3>
<div class="left-align">
<p>Let's break this command down - you're going to use it *a lot*!</p>
<pre><code contenteditable class ="sass css">$ sass --watch scss:css</code></pre>
<p class="fragment"><strong>--watch</strong> tells Sass to look for changes to our .scss files, and to compile them to css if they have updates.</p>
<p class="fragment">The <strong>scss</strong> bit is the folder where our .scss files live. We edit these files only.</p>
<p class="fragment">The <strong>css</strong> part is the folder where our .css files will be. These files are the compiled output of our Sass, and are only created when we run the above command.</p>
</div>
</section>
<!-- Nesting -->
<section class="present">
<h3>Nesting</h3>
<div>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css">header {
color: black;
nav {
background: red;
a { color: white; }
}
</code></pre>
<p>CSS output:</p>
<pre><code contenteditable class ="css sass">header { color: black; }
header nav { background: red; }
header nav a { color: white; }</code></pre>
</div>
</section>
<!-- Comparison-->
<section>
<h3>Referencing Parent Selectors: &</h3>
<div>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css">nav {
background: red;
a {
color: white;
&:hover { text-decoration: underline; }
}
}
</code></pre>
<p>CSS output:</p>
<pre><code contenteditable class ="css sass">nav { background: red; }
nav a { color: white; }
nav a:hover { text-decoration: underline; }</code></pre>
</div>
</section>
<!-- Exercise - #2? 3? -->
<section>
<h3>Let's Develop It!</h3>
<ul>
<li>Open your <span class="blue">styles.scss</span> file</li>
<li>Rewrite some styles to use nesting and referencing the parent</li>
<li>Look for selectors that share a common parent HTML element, like header, nav, footer, #main</li>
<li>Look for hover styles, or add some, to practice referencing the parent with &</li>
<li>There are lots of possible solutions! Be creative!</li>
<li>Run the <a href="#/17" target="_blank">sass --watch command</a> to see your changes in the browser</li>
</ul>
</section>
<!-- BREAK before Part 2 -->
<section>
<h3>Break Time!</h3>
<div>
<p>Stand up and stretch - we'll resume in 5 minutes</p>
<img src="img/stretchbreak.jpg">
</div>
</section>
<!-- Scripting! -->
<section>
<h3>Variables</h3>
<p>Sometimes you want to reuse a value for a style - you use them frequently, they're hard to type or remember, such as</p>
<ul>
<li class="fragment">Colors
<pre><code contenteditable class="sass css">#2a79af</code></pre>
</li>
<li class="fragment"><a target="_blank" href="http://cssfontstack.com/">Font stack styles</a>
<pre><code contenteditable class="sass css">Georgia, Times, "Times New Roman", serif;</code></pre>
</li>
<li class="fragment">Font sizes
<pre><code contenteditable class="sass css">1.667em</code></pre>
</li>
</ul>
</section>
<section>
<h3>Defining Variables</h3>
<p>Variables with Sass let us reuse values more than once, while only defining them in one place</p>
<pre><code contenteditable class="sass css">//define using dollar sign
$brandColor: #f90000;
$mainTextcolor: #fff;
$accentColor: #ccc;</code></pre>
<p>To create a variable you need a dollar sign before the name of your variable, and a colon: to give it a <em>value</em></p>
<p class="fragment">Note that in Sass files, you can comment out a line with <span class="green">// two slashes</span></p>
</section>
<section>
<h3>Variables</h3>
<pre><code contenteditable class="sass css">$brandColor: #f90000; // red
$mainTextcolor: #fff; // white
$accentColor: #ccc; // grey</code></pre>
<pre><code contenteditable class="sass css">header {
color: $mainTextColor;
background-color: $brandColor;
}
.content {
color: $mainTextColor;
background-color: $accentColor;
}
footer {
color: $accentColor;
background-color: $brandColor;
}</code></pre>
</section>
<section>
<h3>Keep em together</h3>
<p>Variables are easy to change if you keep them all in one stylesheet, and update or add to the styles as needed</p>
<pre><code contenteditable class="php">// Let's define some variables
// Colors
$favoriteColor: #2a79af;
$anotherColor: #f05b62;
// Fonts
$favoriteFont: Papyrus, fantasy;
$aPracticalFont: "Trebuchet MS", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Tahoma, sans-serif;
// Font sizes
$aNiceBigFontSize: 16px;
$finePrint: 10px;
$giantLogo: 36px;
// Margins and Padding
$defaultMargin: 15px;
$defaultPadding: $defaultMargin;
</code></pre>
</section>
<!-- Exercise -->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Create a new Sass stylesheet called _utilities.scss</li>
<li>Don't forget to put it in the right folder</li>
<li>Import your new stylesheet into styles.scss by putting the following code at the top of styles.scss:
<pre><code contenteditable class="sass css">@import "_utilities";
</code></pre>
</li>
<li>In your new stylesheet, make some new variables, and base some variables on your existing styles - look for colors, fonts, and size values</li>
<li>Run the <a href="#/17" target="_blank">sass --watch command</a> to see your changes in the browser</li>
</ul>
</section>
<!-- Syntax highlighting -->
<section>
<h3>Syntax highlighting</h3>
<div>
<p>You can download tools to highlight your Sass properly in Sublime Text:</p>
<ul>
<li><a target="_blank" href="http://wbond.net/sublime_packages/package_control/installation">Install Package Manager for Sublime Text 2</a></li>
<li>Go to Tools > Command Palette. Type "Package Control".</li>
<li>Click "Install Package"</li>
<li>Type "Sass" and click the first result</li>
<li>Click: View > Syntax > Sass</li>
</div>
</section>
<!-- Math -->
<section class="present">
<h3>Math Operations</h3>
<div>
<p>With CSS you have to be explicit about everything, including numbers. With Sass, you can write math to calculate numbers for you:</p>
<table style="display: block;margin: 0 auto; width: 300px;">
<!--tr><th>Symbol</th><th>Meaning</th></tr-->
<tr><td>+</td><td><a target="_blank" href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#number_operations">Addition</a></td></tr>
<tr><td>-</td><td><a target="_blank" href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#number_operations">Subtraction</a></td></tr>
<tr><td>*</td><td><a target="_blank" href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#number_operations">Multiplication</a></td></tr>
<tr><td>/</td><td><a target="_blank" href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#division-and-slash">Division</a>*</td></tr>
</table>
<p style="margin-top: 25px;font-size: .6em">*division is special, check the documentation link for why and how</p>
</div>
</section>
<section class="present">
<h3>Math Operations</h3>
<div>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css"><span class="variable">$layoutWidth</span>: 960px;
#sidebar {
width: <span class="variable">$layoutWidth</span>/3;
}
</code></pre>
<p>CSS output:</p>
<pre><code contenteditable class ="sass css">#sidebar {
width: 320px;
}</code></pre>
</div>
</section>
<section class="present">
<h3>Math Operations</h3>
<div>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css"><span class="variable">$layoutWidth</span>: 960px;
$defaultPadding: 16px;
#main {
padding: $defaultPadding;
width: <span class="variable">$layoutWidth</span> - $defaultPadding*2;
}
</code></pre>
<p>CSS output:</p>
<pre><code contenteditable class ="sass css">#main {
padding: 16px;
width: 928px;
}</code></pre>
</div>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Write a math expression in Sass to calculate the width of elements in your page layout instead of declaring a number</li>
<li>Use a variable to represent the result of your calcuation</li>
<li>Compile to CSS and refresh your index page to see your changes</li>
</ul>
<pre><code class ="sass css">$layoutWidth: 960px;
$navWidth: $layoutWidth/3;
footer {
width: ($layoutWidth - 20px);
}</code></pre>
</section>
<section class="present">
<h3>Color Functions</h3>
<p>Color functions are built-in to Sass. They let you alter existing color values. This is the <span class="blue">lighten</span> function:</p>
<table class="code-compare">
<tr><td>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css"><span class="variable">$linkColor</span>: #000;
<span class="variable">$linkShadow</span>: lighten(#000, 40%);
a {
color: <span class="variable">$linkColor</span>;
text-shadow: <span class="variable">$linkShadow</span>;
}
</code></pre>
</td>
<td>
<p>CSS output:</p>
<pre><code contenteditable class ="sass css">a {
color: #000;
text-shadow: #666;
}</code></pre>
<p class="output-example" style="color: #000; text-shadow: 3px 2px #666;">Example of output style</p>
</tr></td></table>
</section>
<section class="present">
<h3>Color Functions</h3>
<p class="left-align">This is the <span class="blue">darken</span> function:</p>
<table class="code-compare">
<tr><td>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css"><span class="variable">$background</span>: #ff0000; // red
<span class="variable">$text</span>: darken($background,50%);
body {
color: <span class="variable">$text</span>;
background: <span class="variable">$background</span>;
}
</code></pre>
</td>
<td>
<p>CSS output:</p>
<pre><code contenteditable class ="sass css">body {
color: #990000;
background: #ff0000;
}</code></pre>
<p class="output-example" style="background-color: #f00; color: #900">Example of output style</p>
</tr></td></table>
</section>
<section class="present">
<h3>Color Functions</h3>
<p class="left-align">This is the <span class="blue">grayscale</span> function:</p>
<table class="code-compare">
<tr><td>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css"><span class="variable">$background</span>: #ff0000; // red
<span class="variable">$text</span>: darken($background,50%);
body {
background: <span class="variable">grayscale(#f00)</span>;
color: <span class="variable">grayscale(darken(#f00, 50%))</span>;
}
</code></pre>
</td>
<td>
<p>CSS output:</p>
<pre><code contenteditable class ="sass css">body {
background: #000;
color: #808080;
}</code></pre>
<p class="output-example grayscale">Example of output style</p>
</tr></td></table>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Edit your variables in _utilities.scss file to use color functions</li>
<li>Refer to the <a target="_blank" href="http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html">sass-lang.com docs</a></li>
<li>Compile to CSS to see your changes</li>
<li class="blue">Bonus - change the color scheme of your website without editing styles.scss!</li>
</ul>
<pre><code class ="sass css">lighten(#000, 20%)
darken(#eee, 30%)
grayscale(#2a79af)
saturate(#2a79af, 40%)
invert(#2a79af)</code></pre>
</section>
<section class="present">
<h3>Comments</h3>
<p class="left-align">Traditional CSS comments are downloaded by the user. With Sass, we can specify whether comments are left in the final CSS code or are only visible to the developer:</p>
<table class="code-compare">
<tr><td>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css"><span class="comment">/* Multiline comments will appear
in the final CSS file */</span>
<span class="value">//This single-line comment won't</span>
a { color: blue; }
</code></pre>
</td>
<td>
<p>CSS output:</p>
<pre><code contenteditable class ="sass css"><span class="comment">/* Multiline comments will appear
in the final CSS file */</span>
a { color: blue; }</code></pre>
</tr></td></table>
</section>
<section class="present">
<h3>Mixins</h3>
<p class="left-align">Mixins are really just a collection of one or more styles that are reusable, like variables are reusable values</p>
<table class="code-compare">
<tr><td>
<p>Sass input:</p>
<pre><code contenteditable class ="sass css"><span class="value">@mixin dropshadow(<span class="variable">$text</span>)</span> {
color: <span class="variable">$text</span>;
text-shadow: 2px 4px lighten(<span class="variable">$text</span>, 50%);
}
p {
<span class="value">@include dropshadow(black);</span>
}
</code></pre>
</td>
<td>
<p>CSS output:</p>
<pre><code contenteditable class ="sass css">p {
color: black;
text-shadow: 2px 4px #808080;
}</code></pre>
<p class="output-example" style="color: black; text-shadow: 2px 4px #808080; background: transparent;">Example of output style</p>
</tr></td></table>
</section>
<section class="present">
<h3>Mixins</h3>
<p class="left-align">These are especially useful for CSS3 rules that need browser prefixes, like gradients.</p>
<p><a target="_blank" href="http://cfarm.co/gradient">cfarm.co/gradient</a></p>
</section>
<!-- Exercise-->
<section>
<h3>Let's Develop It</h3>
<ul>
<li>Add some mixins to your _utilities.scss file - a good candidate is any style that needs a browser prefix</li>
<li>Try replacing the footer gradient with a mixin</li>
<li>Use these mixins in your styles.scss file</li>
<li>Add different types of comments that describe what your mixins do, and check the final CSS in the browser inspector to see if they appear</li>
</ul>
<pre><code class ="sass css">@mixin name {
property: value;
}
@mixin example($argument) {
property: value;
property: $argument;
}
</code></pre>
</section>
<!-- -->
<section>
<h2>Questions?</h2>
<div style="font-size:1200%; height:100%; margin-top:30%" class ="blue">?
<div class ="clear"></div></div>
</section>
</div>
<footer>
<div class="copyright">
Intro to Sass ~ GDI Seattle
<a rel="license" href="http://creativecommons.org/licenses/by-nc/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc/3.0/80x15.png" /></a>
</div>
</footer>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/accessibility-helper/js/accessibility-helper.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
</script>
</body>
</html>