Rinser/gulpfile.js

91 lines
2.8 KiB
JavaScript
Raw Normal View History

2016-03-15 13:15:41 +00:00
"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'),
htmlreplace = require('gulp-html-replace');
var filePath = {
build_dir: './dist'
};
gulp.task('scripts', function() {
return gulp.src(['html/js/shell.js','html/js/app.v3.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(concat('app.js'))
/*.pipe(gulp.dest('dist/js'))*/
/*.pipe(rename({suffix: '.min'}))*/
2016-03-15 13:33:52 +00:00
/* .pipe(uglify({mangle: false}))*/
2016-03-15 13:15:41 +00:00
/*.pipe(concat('app.js'))*/
.pipe(gulp.dest('dist/js'));
2016-03-15 13:15:41 +00:00
});
gulp.task('vendor', function() {
return gulp.src(['html/libs/microevent.js','html/js/moment.min.js','html/js/ejs_production.js','html/js/jquery.unveil.js'])
.pipe(concat('vendor.js'))
2016-03-15 13:30:37 +00:00
.pipe(uglify({mangle: false}))
.pipe(gulp.dest('dist/js'));
});
gulp.task('remote', function() {
return gulp.src(['bower_components/mui/packages/cdn/js/mui.min.js','bower_components/jquery/dist/jquery.min.js','bower_components/string/dist/string.min.js'])
.pipe(concat('remote.js'))
.pipe(uglify({mangle: false}))
.pipe(gulp.dest('dist/js'));
2016-03-15 13:15:41 +00:00
});
gulp.task('styles', function() {
return gulp.src(['bower_components/mui/packages/cdn/css/mui.min.css','html/css/app.css','html/css/md.css'])
2016-03-15 13:15:41 +00:00
.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(concat('app.css'))
.pipe(gulp.dest('dist/css'));
2016-03-15 13:15:41 +00:00
});
gulp.task('partials', function() {
gulp.src(['html/ejs/**/*']).pipe(gulp.dest('dist/ejs'));
gulp.src(['html/icons/**/*']).pipe(gulp.dest('dist/icons'));
2016-03-15 22:08:45 +00:00
gulp.src(['html/assets/fm.png']).pipe(gulp.dest('dist/assets'));
2016-04-01 13:34:04 +00:00
gulp.src(['html/pipes.appcache']).pipe(gulp.dest('dist/'));
2016-03-15 13:15:41 +00:00
});
gulp.task('index', function () {
var sources = gulp.src(['js/apps.js', 'css/app.css'], {read: false});
return gulp.src(['html/index.html'])
.pipe(htmlreplace({
'css': 'css/app.css',
'js': 'js/app.js',
'vendor': 'js/vendor.js',
'remote': 'js/remote.js'
2016-03-15 13:15:41 +00:00
}))
.pipe(htmlmin({removeComments: true, collapseWhitespace: true, keepClosingSlash: true}))
.pipe(gulp.dest('dist/'));
});
gulp.task('clean', function() {
return del(['dist']);
});
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts', 'remote', 'vendor', 'partials','index');
2016-03-15 13:15:41 +00:00
});