-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
46 lines (33 loc) · 1.16 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var header = require('gulp-header');
var size = require('gulp-size');
var replace = require('gulp-replace');
var sass = require('gulp-sass');
var fs = require('fs');
var pkg = require('./package.json');
pkg.year = new Date().getFullYear();
var banner = '// <%= pkg.name %> v<%= pkg.version %> - <%= pkg.description %>\n' +
'// Copyright (c) <%= pkg.year %> <%= pkg.author.name %> - <%= pkg.homepage %>\n' +
'// License: <%= pkg.licenses[0].type %> - <%= pkg.licenses[0].url %>\n';
var tilt = fs.readFileSync('./src/tilt.js', 'utf8');
gulp.task('lib',function() {
return gulp.src('./src/*.js')
.pipe(replace('/* TILT */',tilt))
.pipe(uglify())
.pipe(header(banner,{pkg:pkg}))
.pipe(size({
'showFiles':true,
'gzip':true
}))
.pipe(gulp.dest('./dist'));
});
gulp.task('sass',function(){
return gulp.src('styles.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./'));
});
gulp.task('dev',['lib','sass'],function() {
gulp.watch(['./src/*.js'],['lib']);
gulp.watch(['./*.scss'],['sass']);
});