Miguel Cantillana F
<miguel@ewok.cl>
Syntactically Awesome StyleSheets
#main p {
color: #00ff00;
width: 97%;
.redbox {
background-color: #ff0000;
color: #000000;
}
}
Produce:
Sass
#main p {
color: #00ff00;
width: 97%;
}
#main p .redbox {
background-color: #ff0000;
color: #000000;
}
#main {
width: 97%;
p, div {
font-size: 2em;
a { font-weight: bold; }
}
pre { font-size: 3em; }
}
Produce:
Sass
#main {
width: 97%;
}
#main p, #main div {
font-size: 2em;
}
#main p a, #main div a {
font-weight: bold;
}
#main pre {
font-size: 3em;
}
a {
font-weight: bold;
text-decoration: none;
&:hover { text-decoration: underline; }
body.firefox & { font-weight: normal; }
}
Produce:
Sass
a {
font-weight: bold;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
body.firefox a {
font-weight: normal;
}
.funky {
font: {
family: fantasy;
size: 30em;
weight: bold;
}
}
Produce:
Sass
.funky {
font-family: fantasy;
font-size: 30em;
font-weight: bold;
}
$width: 5em;
/* Ahora ya puedes utilizar la variable
llamada $width como valor de cualquier
propiedad CSS: */
#main {
width: $width;
}
Produce:
Sass
#main {
width: 5em;
}
.sidebar {
width: 300px;
@media screen and (orientation: landscape) {
width: 500px;
}
}
Produce:
Sass
.sidebar {
width: 300px;
}
@media screen and (orientation: landscape) {
.sidebar {
width: 500px;
}
}
.foo {
color: red;
}
.bar {
@extend .foo;
}
.foo, .bar {
color: red;
}
.error {
border: 1px #f00;
background-color: #fdd;
}
.seriousError {
@extend .error;
border-width: 3px;
}
Produce:
Sass
.error, .seriousError {
border: 1px #f00;
background-color: #fdd;
}
.seriousError {
border-width: 3px;
}
@mixin large-text {
font: {
family: Arial;
size: 20px;
weight: bold;
}
color: #ff0000;
}
@mixin clearfix {
display: inline-block;
&:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
* html & { height: 1px }
}
Sass
@mixin sexy-border($color, $width) {
border: {
color: $color;
width: $width;
style: dashed;
}
}
Sass
.page-title {
@include large-text;
padding: 4px;
margin-top: 10px;
}
p { @include sexy-border(blue, 1in); }
Sass
p {
border-color: blue;
border-width: 1in;
border-style: dashed;
}
Sass
#main {
color: #fff;
background-color: #000; }
#main p {
width: 10em; }
.huge {
font-size: 10em;
font-weight: bold;
text-decoration: underline; }
El formato :nested
#main {
color: #fff;
background-color: #000;
}
#main p {
width: 10em;
}
.huge {
font-size: 10em;
font-weight: bold;
text-decoration: underline;
}
El formato :expanded
#main { color: #fff; background-color: #000; }
#main p { width: 10em; }
.huge { font-size: 10em; font-weight: bold; text-decoration: underline; }
El formato :compact
#main{color:#fff;background-color:#000}#main p{width:10em}.huge{font-size:10em;font-weight:bold;text-decoration:underline}
El formato :compressed
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('styles', function() {
gulp.src('sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css/'))
});
//Watch task
gulp.task('default',function() {
gulp.watch('sass/**/*.scss',['styles']);
});
http://ryanchristiani.com/getting-started-with-gulp-and-sass/
Dado el siguiente repositiorio realizar lo siguiente: