Created
September 7, 2015 20:45
-
-
Save AleksejDix/f44efb14753945eee92b to your computer and use it in GitHub Desktop.
gulp setup must be improved
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
var | |
gulp = require('gulp'), | |
stylus = require('gulp-stylus'), | |
postcss = require('gulp-postcss'), | |
sourcemaps = require('gulp-sourcemaps'), | |
autoprefixer = require('autoprefixer'), | |
rupture = require('rupture'), | |
nunjucksRender = require('gulp-nunjucks-render'), | |
lost = require('lost'), | |
plumber = require('gulp-plumber'), | |
gutil = require('gulp-util'), | |
data = require('./jsonplaceholder'); | |
var onError = function (err) { | |
gutil.beep(); | |
gutil.log('stylus fehler', gutil.color.magenta('123')); | |
console.log(err); | |
}; | |
gulp.task('styles', function() { | |
return gulp | |
.src('./src/stylus/*') | |
.pipe(plumber({ | |
errorHandler: onError | |
})) | |
.pipe(sourcemaps.init()) | |
.pipe(stylus({ | |
use: rupture(), | |
compress: false, | |
linenos: true, | |
})) | |
.pipe( | |
postcss([ | |
lost(), | |
autoprefixer() | |
]) | |
) | |
.pipe(sourcemaps.write('./')) | |
.pipe(gulp.dest('./build/css')); | |
}); | |
gulp.task('templates', function() { | |
return gulp | |
.src('./src/views/*.*') | |
.pipe(nunjucksRender(data)) | |
.pipe(gulp.dest('./build/')); | |
}); | |
gulp.task('js',function(){ | |
return gulp | |
.src('./src/js/**/*.js') | |
.pipe(gulp.dest('./build/js/')) | |
}) | |
gulp.watch('./src/js/*.*',['js']); | |
gulp.watch('./src/views/*.html',['templates']); | |
gulp.watch('./src/stylus/**/*.styl', ['styles']); | |
gulp.task('default',['styles', 'js', 'templates']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment