var gulp = require('gulp'); var autoprefixer = require('gulp-autoprefixer'); var cssnano = require('gulp-cssnano'); var jshint = require('gulp-jshint'); var jsmin = require('gulp-jsmin'); var uglify = require('gulp-uglify'); var rename = require('gulp-rename'); var concat = require('gulp-concat'); var notify = require('gulp-notify'); var cache = require('gulp-cache'); var livereload = require('gulp-livereload'); var htmlmin = require('gulp-htmlmin'); var inject = require('gulp-inject'); var htmlreplace = require('gulp-html-replace'); var stripDebug = require('gulp-strip-debug'); var del = require('del'); var googleWebFonts = require('gulp-google-webfonts'); var options = {}; gulp.task('partials', function() { gulp.src(['app/assets/fm.png']).pipe(gulp.dest('dist/assets')); gulp.src(['app/ejs/*.ejs']).pipe(gulp.dest('dist/ejs')); //gulp.src(['app/js/output.min.js']).pipe(gulp.dest('dist/js')); }); gulp.task('styles', function() { return gulp.src([ 'app/css/normalize.css', 'app/css/skeleton.css' ]) .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) .pipe(cssnano()) .pipe(concat('app.css')) .pipe(gulp.dest('dist/css')); }); gulp.task('fonts', function() { return gulp.src('./fonts.list') .pipe(googleWebFonts(options)) .pipe(gulp.dest('dist/fonts')); }); /* */ gulp.task('vendor', function() { return gulp.src([ 'app/js/output.min.js', 'app/js/fx.js', 'app/js/fx_methods.js', 'app/js/zprogress.js', 'app/js/jquery.unveil.js' ]) .pipe(concat('vendor.js')) .pipe(uglify({mangle: false})) .pipe(gulp.dest('dist/js')); }); gulp.task('scripts', function() { return gulp.src([ 'app/js/app.prod.js' ]) .pipe(jshint('.jshintrc')) .pipe(jshint.reporter('default')) // .pipe(concat('app.js')) .pipe(stripDebug()) .pipe(jsmin()) .pipe(gulp.dest('dist/js')); }); gulp.task('index', function() { //var sources = gulp.src(['js/apps.js', 'css/app.css'], {read: false}); return gulp.src(['app/feeds.html']) .pipe(htmlreplace({ css: 'css/app.css', js: 'js/app.prod.js', vendor: 'js/vendor.js', fonts: 'fonts/fonts.css' })) .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', 'vendor', 'fonts', 'partials', 'index'); }); gulp.task('migrate', function() { return gulp.src(['dist/**/*']) // .pipe(debug({title: 'migrate:'})) .pipe(gulp.dest('/Users/martin/newdev/Feedmaster/app/src/main/assets')); });