Last active
September 26, 2016 15:45
-
-
Save slavafomin/a2709a5eb396f9ccf89ec65e7cf2a797 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 gulpPostcss = require('gulp-postcss'); | |
const postcssPartialImport = require('postcss-partial-import'); | |
const postcssCssnext = require('postcss-cssnext'); | |
const gulpRename = require('gulp-rename'); | |
const gulpLivereload = require('gulp-livereload'); | |
const gulpCssnano = require('gulp-cssnano'); | |
const gulpif = require('gulp-if'); | |
const sourcemaps = require('gulp-sourcemaps'); // <======================================== | |
module.exports = function (gulp) { | |
var processors = [ | |
postcssPartialImport({ | |
extension: '.pcss' | |
}), | |
postcssCssnext | |
]; | |
return gulp.src(SRC_PATH + '/styles/*.pcss') | |
.pipe(gulpif(!global.dist, sourcemaps.init())) // <======================================== | |
.pipe(gulpPostcss(processors)) | |
.pipe(gulpRename(function(filePath) { | |
filePath.extname = '.css'; | |
})) | |
.pipe(gulpif(global.dist, gulpCssnano())) | |
.pipe(gulpif(!global.dist, sourcemaps.write('.'))) // <======================================== | |
.pipe(gulp.dest(TARGET_PATH + '/css')) | |
.pipe(gulpLivereload()) | |
; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment