Skip to content

Instantly share code, notes, and snippets.

@icholy
Created January 12, 2015 21:58
Show Gist options
  • Save icholy/9e55422447550339fb5b to your computer and use it in GitHub Desktop.
Save icholy/9e55422447550339fb5b to your computer and use it in GitHub Desktop.
var gulp = require('gulp'),
typescript = require('gulp-typescript'),
sass = require('gulp-sass'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload'),
http = require('http'),
st = require('st');
gulp.task('scripts', function () {
gulp
.src('./src/scripts/*.ts')
.pipe(concat('main.ts'))
.pipe(typescript({ declarationFiles: true }))
.pipe(gulp.dest('./build/scripts/'))
.pipe(livereload());
});
gulp.task('views', function () {
gulp
.src('./src/*.html')
.pipe(gulp.dest('./build/'))
.pipe(livereload());
});
gulp.task('styles', function () {
gulp
.src('./src/styles/*.scss')
.pipe(sass())
.pipe(concat('style.css'))
.pipe(gulp.dest('./build/styles'))
.pipe(livereload());
});
gulp.task('watch', ['build'], function (done) {
livereload.listen();
http.createServer(
st({
path: __dirname + '/build/',
cache: false
})
).listen(8080, done);
gulp.watch('./src/scripts/*', ['scripts']);
gulp.watch('./src/styles/*', ['styles']);
gulp.watch('./src/*.html', ['views']);
});
gulp.task('build', ['scripts', 'views', 'styles']);
gulp.task('default', ['build']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment