61 lines
1.8 KiB
JavaScript
61 lines
1.8 KiB
JavaScript
|
"use strict";
|
||
|
var gulp = require('gulp'),
|
||
|
|
||
|
autoprefixer = require('gulp-autoprefixer'),
|
||
|
cssnano = require('gulp-cssnano'),
|
||
|
jshint = require('gulp-jshint'),
|
||
|
uglify = require('gulp-uglify'),
|
||
|
|
||
|
rename = require('gulp-rename'),
|
||
|
concat = require('gulp-concat'),
|
||
|
notify = require('gulp-notify'),
|
||
|
cache = require('gulp-cache'),
|
||
|
livereload = require('gulp-livereload'),
|
||
|
htmlmin = require('gulp-htmlmin'),
|
||
|
inject = require('gulp-inject'),
|
||
|
del = require('del');
|
||
|
|
||
|
|
||
|
|
||
|
gulp.task('scripts', function() {
|
||
|
return gulp.src('app/js/**/*.js')
|
||
|
.pipe(jshint('.jshintrc'))
|
||
|
.pipe(jshint.reporter('default'))
|
||
|
.pipe(concat('main.js'))
|
||
|
.pipe(gulp.dest('dist/js'))
|
||
|
.pipe(rename({suffix: '.min'}))
|
||
|
.pipe(uglify())
|
||
|
.pipe(gulp.dest('dist/js'))
|
||
|
.pipe(notify({ message: 'Scripts task complete' }));
|
||
|
});
|
||
|
|
||
|
gulp.task('styles', function() {
|
||
|
return gulp.src('app/css/**/*.css')
|
||
|
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
|
||
|
.pipe(gulp.dest('dist/css'))
|
||
|
.pipe(rename({suffix: '.min'}))
|
||
|
.pipe(cssnano())
|
||
|
.pipe(gulp.dest('dist/css'))
|
||
|
.pipe(notify({ message: 'Styles task complete' }));
|
||
|
});
|
||
|
|
||
|
gulp.task('partials', function() {
|
||
|
|
||
|
gulp.src(['app/partials/**/*']).pipe(gulp.dest('dist/partials'));
|
||
|
gulp.src(['app/libs/ejs_production.js']).pipe(gulp.dest('dist/libs'));
|
||
|
});
|
||
|
|
||
|
gulp.task('minify-html', function () {
|
||
|
|
||
|
return gulp.src(['app/index.prod.html']).pipe(htmlmin({removeComments: true, collapseWhitespace: true, keepClosingSlash: true}))
|
||
|
.pipe(gulp.dest('dist/index.html'));
|
||
|
});
|
||
|
|
||
|
gulp.task('clean', function() {
|
||
|
return del(['dist']);
|
||
|
});
|
||
|
|
||
|
|
||
|
gulp.task('default', ['clean'], function() {
|
||
|
gulp.start('styles', 'scripts','partials','minify-html');
|
||
|
});
|