Created
March 4, 2015 06:16
-
-
Save ctolkien/2429a305a09582d79bfa to your computer and use it in GitHub Desktop.
asp.net 5 gulpfile
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
| var gulp = require('gulp'); | |
| var bower = require('gulp-bower'); | |
| var less = require('gulp-less'); | |
| var sourcemaps = require('gulp-sourcemaps'); | |
| var aspnetk = require("gulp-aspnet-k"); | |
| var imagemin = require('gulp-imagemin'); | |
| var pngquant = require('imagemin-pngquant'); | |
| var gutil = require('gulp-util'); | |
| var plumber = require('gulp-plumber'); | |
| var colors = require('colors'); | |
| gulp.task('bower', function() { | |
| return bower({cmd:'install', production:true}) | |
| .pipe(gulp.dest('wwwroot/lib/')) | |
| }); | |
| gulp.task('less', function() { | |
| gulp.src('./css/**/main.less') | |
| .pipe(plumber({ errorHandler: onError })) | |
| .pipe(sourcemaps.init()) | |
| .pipe(less({compress: true})) | |
| .pipe(sourcemaps.write('maps')) | |
| .pipe(gulp.dest('./wwwroot/css/')); | |
| }); | |
| gulp.task('watch', ['less'], function () { | |
| gulp.watch('./css/**/*.less', ['less']) | |
| }); | |
| gulp.task('aspnet-run', aspnetk({restore: false})); | |
| gulp.task('optimiseimages', function() { | |
| return gulp.src('./wwwroot/images/*') | |
| .pipe(imagemin({ | |
| progressive: true, | |
| svgoPlugins: [{removeViewBox: false}], | |
| use: [pngquant()] | |
| })) | |
| .pipe(gulp.dest('./wwwroot/images/')); | |
| }); | |
| gulp.task('default', ['watch', 'aspnet-run']); | |
| var onError = function (err) { | |
| gutil.beep(); | |
| console.error(err.message.red); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment