On Github chaddattilio / sass-presentation
Rhys Harrison / Chad Dattilio
Some examples:
Variables
$red: #ff0b13; $blue: #091fff; $green: #11c909;
.i-want-to-be-green { color: $green; }
Vendor prefixes
.rounded { @include border-radius(4px); }
.rounded { -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; }
Nesting rules
nav { a { color: $red; &:hover { color: $green; } &:visited { color: $blue; } } }
nav a { color: #ff0b13; } nav a:hover { color: #11c909; } nav a:visited { color: #091fff; }
Media queries
@media only screen and (min-width: 280px) and (max-width: 479px) { .h1 { font-size: 1.1em; } } @media only screen and (min-width: 600px) and (max-width: 767px) { .h1 { font-size: 0.9em; } }
h1 { @include MQ(XS) { font-size: 1.1em; } @include MQ(M) { font-size: 0.9em; } }
Some examples:
With Sass, you have to roll your own mixins:
@mixin border-radius($radius) { -webkit-border-radius: $radius; -moz-border-radius: $radius; -ms-border-radius: $radius; border-radius: $radius; } .box { @include border-radius(10px); }
Compass comes bundled with a CSS3 module that includes all these mixins, so you just:
.box { @include border-radius(10px); }
Compass also comes with a typography module, so you can do things like this;
a { // link colors (normal, hover, active, visited, focus) @include link-colors(red, blue, grey, red, blue); }
Both SASS and Compass are Ruby "gems" (Ruby applications or plugins).
Windows users: http://rubyinstaller.org/downloads/
Compass is a framework that offers reusable patterns (think of it like a jQuery for SASS). When you install Compass, it automatically includes SASS.
Windows users: from the Ruby command line, type:
gem install compass --pre
Mac users: from the Terminal, type:
sudo gem install compass --pre
Normally you can move to the folder that contains your project and type "compass create" at the command prompt (or use your GUI to create a new project). This creates a bunch of boilerplate folders / files that you may not need. For a bare installation, type:
compass create --bare --sass-dir "sass" --css-dir "css" --javascripts-dir "js" --images-dir "img"
This file is automatically created and looks like this:
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "css" sass_dir = "sass" images_dir = "img" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): # output_style = :expanded or :nested or :compact or :compressed # To enable relative paths to assets via compass helper functions. Uncomment: # relative_assets = true # To disable debugging comments that display the original location of your selectors. Uncomment: # line_comments = false
When making changes to the config.rb file, particularly output style, it's sometimes necessary to clear the.sass-cache before expected changes will be seen. In this instance, either manually delete the sass-cache folder and it will be recreated next time a Sass file is saved, or run the following command from the command line:
compass clean
If you don't set an output style in config.rb, Sass and Compass produce rules in this format:
/* line 8, ../sass/styles.scss */ #main { color: #999; } /* line 10, ../sass/styles.scss */ #main .content { color: #bfbfbf; }
In config.rb, if you do this: output_style = :nested
#main { color: #999; .content { color: #bfbfbf; } }
would produce CSS like this:
/* line 8, ../sass/styles.scss */ #main { color: #999; } /* line 10, ../sass/styles.scss */ #main .content { color: #bfbfbf; }
In config.rb, if you do this: output_style = :compact
#main { color: #999; .content { color: #bfbfbf; } }
would produce CSS like this:
/* line 8, ../sass/styles.scss */ #main { color: #999; } /* line 10, ../sass/styles.scss */ #main .content { color: #bfbfbf; }
In config.rb, if you do this: output_style = :compressed
#main { color: #999; .content { color: #bfbfbf; } }
would produce CSS like this:
#main{color:#999}#main .content{color:#bfbfbf}
Create a folder named /partials. Within that folder, create a file called _variables.scss. The underscore tells Sass to not compile the file into its equivalent .css file (which it does for normal .scss files). This must be referenced before any file that uses the variables.
From the command line, type 'compass watch' in the project folder, Sass will monitor for .scss file changes and recompile into .css files.
You can alternatively use a GUI tool like Scout.
You can also manually compile .scss files into .css with 'compass compile' from command line.
Creating a Project Builder in Eclipse to monitor and recompile .scss files into .css files on save of file (see example).
nav { ul { margin: 0; padding: 0; list-style: none; } li { display: inline-block; } a { display: block; padding: 6px 12px; text-decoration: none; } }
For those of you who like that sort of thing. Instructions and a bit more info available here.
<section data-markdown> ## Markdown support For those of you who like that sort of thing. Instructions and a bit more info available [here](https://github.com/hakimel/reveal.js#markdown). </section>
You can select from different transitions, like: Cube - Page - Concave - Zoom - Linear - Fade - None - Default
Reveal.js comes with a few themes built in: Default - Sky - Beige - Simple - Serif - Night Moon - Solarized
* Theme demos are loaded after the presentation which leads to flicker. In production you should load your theme in the <head> using a <link>.
Set data-state="something" on a slide and "something" will be added as a class to the document element when the slide is open. This lets you apply broader style changes, like switching the background.
Additionally custom events can be triggered on a per slide basis by binding to the data-state name.
Reveal.addEventListener( 'customevent', function() { console.log( '"customevent" has fired' ); } );
Set data-background="#007777" on a slide to change the full page background to the given color. All CSS color formats are supported.
<section data-background="image.png">
<section data-background="image.png" data-background-repeat="repeat" data-background-size="100px">
Pass reveal.js the backgroundTransition: 'slide' config argument to make backgrounds slide rather than fade.
You can override background transitions per slide by using data-background-transition="slide".
These guys come in two forms, inline: “The nice thing about standards is that there are so many to choose from” and block:
“For years there has been a theory that millions of monkeys typing at random on millions of typewriters would reproduce the entire works of Shakespeare. The Internet has proven this theory to be untrue.”function linkify( selector ) { if( supports3DTransforms ) { var nodes = document.querySelectorAll( selector ); for( var i = 0, len = nodes.length; i < len; i++ ) { var node = nodes[i]; if( !node.className ) { node.className += ' roll'; } } } }
Courtesy of highlight.js.
You can link between slides internally, like this.
Hit the next arrow...
... to step through ...
any type of view fragments This slide has fragments which are also stepped through in the notes window.There's a few styles of fragments, like:
grow
shrink
roll-in
fade-out
highlight-red
highlight-green
highlight-blue
current-visible
highlight-current-blue
Presentations can be exported to PDF, below is an example that's been uploaded to SlideShare.
Press b or period on your keyboard to enter the 'paused' mode. This mode is helpful when you want to take distracting slides off the screen during a presentation.