1

Adding build tasks for debug and release

This commit is contained in:
Alex Yatskov 2014-09-30 17:54:36 +09:00
parent 48c2a301e3
commit 463b838567

View File

@ -34,25 +34,36 @@ gulp.task('lint', function() {
.pipe(jshint.reporter('default')); .pipe(jshint.reporter('default'));
}); });
gulp.task('scripts', function() { gulp.task('js', function() {
return gulp.src(paths.js) return gulp.src(paths.js)
.pipe(concat('scripts.js')) .pipe(concat('scripts.js'))
.pipe(uglify()) .pipe(uglify())
.pipe(gulp.dest('dist')); .pipe(gulp.dest('./dist'));
}); });
gulp.task('styles', function() { gulp.task('css', function() {
return gulp.src(paths.css) return gulp.src(paths.css)
.pipe(concat('styles.css')) .pipe(concat('styles.css'))
.pipe(minifyCss()) .pipe(minifyCss())
.pipe(gulp.dest('dist')); .pipe(gulp.dest('./dist'));
}); });
gulp.task('pages', function() { gulp.task('html_debug', function() {
var sources = gulp.src(paths.js.concat(paths.css), { read: false }); var sources = gulp.src(paths.js.concat(paths.css), { read: false });
return gulp.src(paths.html) return gulp.src(paths.html)
.pipe(inject(sources)) .pipe(inject(sources))
.pipe(gulp.dest('./')); .pipe(gulp.dest('./'));
}); });
gulp.task('default', ['lint', 'scripts', 'styles', 'pages']); gulp.task('html_release', function() {
var sources = gulp.src(['./dist/*.js', './dist/*.css'], { read: false });
return gulp.src(paths.html)
.pipe(inject(sources))
.pipe(gulp.dest('./'));
});
gulp.task('debug', ['lint', 'html_debug']);
gulp.task('release', ['lint', 'js', 'css', 'html_release']);
gulp.task('default', ['debug']);