Created
August 3, 2017 20:12
-
-
Save tomfinitely/a57758d4cd551a6c3c64547510498723 to your computer and use it in GitHub Desktop.
SEOThemes Studio Pro Replacement Gulp SASS Output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Compile Sass. | |
* | |
* https://www.npmjs.com/package/gulp-sass | |
*/ | |
gulp.task( 'styles', function () { | |
gulp.src( paths.styles ) | |
// Notify on error | |
.pipe( plumber( { errorHandler: notify.onError( "Error: <%= error.message %>" ) } ) ) | |
// Source maps init | |
.pipe( sourcemaps.init() ) | |
// Process sass | |
.pipe( sass( { | |
outputStyle: 'expanded' | |
} ) ) | |
// Pixel fallbacks for rem units. | |
.pipe( pixrem() ) | |
// Parse with PostCSS plugins. | |
.pipe( postcss( [ | |
autoprefixer( { | |
browsers: AUTOPREFIXER_BROWSERS | |
} ), | |
mqpacker( { | |
sort: true | |
} ), | |
] ) ) | |
// Format non-minified stylesheet. | |
.pipe ( cleancss( { | |
format: format | |
} ) ) | |
// Inject changes via browsersync. | |
.pipe( browsersync.reload( { stream: true } ) ) | |
// Process sass again. | |
.pipe( sass( { | |
outputStyle: 'compressed' | |
} ) ) | |
// Combine similar rules. | |
.pipe ( cleancss( { | |
level: { | |
2: { | |
all: true | |
} | |
} | |
} ) ) | |
// Minify and optimize style.css again. | |
.pipe( cssnano( { | |
safe: false, | |
discardComments: { | |
removeAll: false, | |
}, | |
} ) ) | |
// Write source map. | |
.pipe( sourcemaps.write( './' ) ) | |
// Output the compiled sass to this directory. | |
.pipe( gulp.dest( './' ) ) | |
// Filtering stream to only css files. | |
.pipe( filter( '**/*.css' ) ) | |
// Notify on successful compile (uncomment for notifications). | |
.pipe( notify( "Compiled: <%= file.relative %>" ) ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment