Last active
April 26, 2016 18:31
-
-
Save krambuhl/1022c2718f5f9ae617bfe2e6bc07a9fa to your computer and use it in GitHub Desktop.
POC. Gulp tasks as modules.
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
const path = require('path'); | |
const gulp = require('gulp'); | |
const sourcemaps = require('gulp-sourcemaps'); | |
const sass = require('gulp-sass'); | |
const postcss = require('gulp-postcss'); | |
const autoprefixer = require('autoprefixer-core'); | |
module.exports = function(opts) { | |
return function() { | |
return gulp.src(opts.src) | |
.pipe(sourcemaps.init()) | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(postcss([ | |
autoprefixer({ browsers: ['last 2 version'] }) | |
])) | |
.pipe(sourcemaps.write('.')) | |
.pipe(gulp.dest(opts.dest)) | |
} | |
}; |
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
const gulp = require('gulp'); | |
const buildStyles = require('./build-styles'); | |
gulp.task('styles', buildStyles({ | |
src: 'source/styles/*.scss', | |
dest: 'dest/assets' | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment