Task `styles`
/** | |
* Task: styles | |
* | |
* Compiles Sass, Autoprefixes it and Minifies CSS. | |
* | |
* This task does the following: | |
* 1. Gets the source scss file | |
* 2. Compiles Sass to CSS | |
* 3. Writes Sourcemaps for it | |
* 4. Autoprefixes it and generates style.css | |
* 5. Renames the CSS file with suffix .min.css | |
* 6. Minifies the CSS file and generates style.min.css | |
*/ | |
gulp.task('styles', function () { | |
gulp.src( styleSRC ) | |
.pipe( sourcemaps.init() ) | |
.pipe( sass( { | |
errLogToConsole: true, | |
outputStyle: 'compact', | |
//outputStyle: 'compressed', | |
// outputStyle: 'nested', | |
// outputStyle: 'expanded', | |
precision: 10 | |
} ) ) | |
.pipe( sourcemaps.write( { includeContent: false } ) ) | |
.pipe( sourcemaps.init( { loadMaps: true } ) ) | |
.pipe( autoprefixer( | |
'last 2 version', | |
'> 1%', | |
'safari 5', | |
'ie 8', | |
'ie 9', | |
'opera 12.1', | |
'ios 6', | |
'android 4' ) ) | |
.pipe( sourcemaps.write ( styleDestination ) ) | |
.pipe( gulp.dest( styleDestination ) ) | |
.pipe( rename( { suffix: '.min' } ) ) | |
.pipe( minifycss( { | |
maxLineLen: 10 | |
})) | |
.pipe( gulp.dest( styleDestination ) ) | |
.pipe( notify( { message: 'TASK: "styles" Completed!', onLast: true } ) ) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment