Created
September 20, 2018 15:57
-
-
Save fernandiez/ab5c22c10a920bf8f4275d1186edfe29 to your computer and use it in GitHub Desktop.
Compiliar Sass
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
// CSS settings | |
var css = { | |
src : dir.src + 'scss/style.scss', | |
watch : dir.src + 'scss/**/*', | |
build : dir.build, | |
sassOpts: { | |
outputStyle : 'nested', | |
imagePath : images.build, | |
precision : 3, | |
errLogToConsole : true | |
}, | |
processors: [ | |
require('postcss-assets')({ | |
loadPaths: ['images/'], | |
basePath: dir.build, | |
baseUrl: '/wp-content/themes/wptheme/' | |
}), | |
require('autoprefixer')({ | |
browsers: ['last 2 versions', '> 2%'] | |
}), | |
require('css-mqpacker'), | |
require('cssnano') | |
] | |
}; | |
// CSS processing | |
gulp.task('css', ['images'], () => { | |
return gulp.src(css.src) | |
.pipe(sass(css.sassOpts)) | |
.pipe(postcss(css.processors)) | |
.pipe(gulp.dest(css.build)) | |
.pipe(browsersync ? browsersync.reload({ stream: true }) : gutil.noop()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment