I am trying to run a gulp task I have to compile my less files with some extra functionality. I want when a --production flag is passed it then .pipes the results to various destination according to an array of languages that where set earlier. I currently have it working but there is alot of overhead because it compiles and run uncss each time.
Currently
From the js
lang.forEach(o => {
if (shell.exec("npm run less -- --production --lang " + o).code) {
shell.echo(red('Less css compile error'));
shell.exit(1);
}
})
then the gulp file
gulp.task 'less', ->
gulp.src(cssSrc)
.pipe(logger(
before: 'Compiling less files ...'
after: 'Less files compiled'
showChange: true))
.pipe(less()
.on('error', gutil.log)
.on('error', gutil.beep)
.on('error', (err) ->
pathToFile = err.fileName.split('\\')
file = pathToFile[pathToFile.length - 1]
return
))
.pipe(minifyCSS())
.pipe(rename('styles.min.css'))
.pipe(gulpif(argv.production, uncss(unCssOptions)))
.pipe gulp.dest('public/' + argv.lang + '/assets/css' )
return
This is does not work to well either because if I dont run production flag mode it creates a undefined folder.
If someone would car to educate me on this would be great.
Thank
via Alex Kirwan
No comments:
Post a Comment