Skip to content

Instantly share code, notes, and snippets.

@atitsbest
Created May 8, 2015 07:04
Show Gist options
  • Save atitsbest/1e26229733ec626cf446 to your computer and use it in GitHub Desktop.
Save atitsbest/1e26229733ec626cf446 to your computer and use it in GitHub Desktop.
Erstes Gulp.js - Experiment
/**
* npm install --save-dev gulp gulp-less-sourcemap gulp-autoprefixer gulp-minify-css gulp-notify gulp-tcs gulp-watch del
*
*/
var gulp = require('gulp'),
less = require('gulp-less-sourcemap'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
notify = require('gulp-notify'),
typescript = require('gulp-tsc'),
watch = require('gulp-watch'),
path = require('path'),
del = require('del');
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts');
});
gulp.task('watch', function() {
gulp.watch('./css/**/*.less', ['styles']);
gulp.watch('./js/**/*.ts', ['scripts']);
});
gulp.task('clean', function(cb) {
del(['dist/css', 'dist/js'], cb)
});
gulp.task('scripts', function() {
gulp.src(['./js/**/*.ts'])
.pipe(typescript({sourcemap: true}))
.on('error', function (error) { return false; })
.pipe(gulp.dest('./dist/js'));
});
gulp.task('styles', function () {
gulp.src('./css/**/*.less')
.pipe(less({
sourceMap: {
sourceMapRootpath: '../css' // Optional absolute or relative path to your LESS files
}
}))
.pipe(autoprefixer('last 3 version, > 5%, ie 8'))
.pipe(minifycss())
.pipe(gulp.dest('./dist/css'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment