mirror of
https://gitlab.silvrtree.co.uk/martind2000/recipes.git
synced 2025-01-10 20:45:07 +00:00
106 lines
3.3 KiB
JavaScript
106 lines
3.3 KiB
JavaScript
'use strict';
|
|
var gulp = require('gulp');
|
|
var autoprefixer = require('gulp-autoprefixer');
|
|
var cssnano = require('gulp-cssnano');
|
|
var jshint = require('gulp-jshint');
|
|
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 del = require('del');
|
|
var htmlreplace = require('gulp-html-replace');
|
|
|
|
var googleWebFonts = require('gulp-google-webfonts');
|
|
|
|
|
|
var filePath = {
|
|
build_dir: './dist'
|
|
};
|
|
|
|
var fontOptions = { };
|
|
|
|
gulp.task('fonts', function() {
|
|
return gulp.src('./fonts.list')
|
|
.pipe(googleWebFonts(fontOptions))
|
|
.pipe(gulp.dest('dist/fonts'))
|
|
;
|
|
});
|
|
|
|
gulp.task('linearicons', function() {
|
|
|
|
gulp.src(['src/linearicons/webfont/style.css']).pipe(gulp.dest('dist/fonts'));
|
|
gulp.src(['src/linearicons/webfont/fonts/**/*']).pipe(gulp.dest('dist/fonts'));
|
|
});
|
|
|
|
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(concat('app.js'))
|
|
/*.pipe(uglify({mangle: false}))*/
|
|
.pipe(gulp.dest('dist/js'));
|
|
});
|
|
|
|
gulp.task('vendor', function() {
|
|
return gulp.src(['app/libs/microevent.js','src/bower_modules/mui/packages/cdn/js/mui.min.js','src/bower_modules/jquery/dist/jquery.min.js','app/libs/ejs_production.js'])
|
|
/*.pipe(gulp.dest('dist/js'))*/
|
|
/*.pipe(rename({suffix: '.min'}))*/
|
|
.pipe(concat('vendor.js'))
|
|
/*.pipe(uglify({mangle: false}))*/
|
|
.pipe(gulp.dest('dist/js'));
|
|
});
|
|
|
|
|
|
|
|
gulp.task('styles', function() {
|
|
return gulp.src(['app/css/app.css','app/css/md.css','app/css/read.css','app/css/gist.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(concat('app.css'))
|
|
.pipe(gulp.dest('dist/css'));
|
|
});
|
|
|
|
gulp.task('partials', function() {
|
|
|
|
gulp.src(['app/partials/**/*']).pipe(gulp.dest('dist/partials'));
|
|
gulp.src(['app/fav/**/*']).pipe(gulp.dest('dist/fav'));
|
|
gulp.src(['app/gfx/**/*']).pipe(gulp.dest('dist/gfx'));
|
|
gulp.src(['src/bower_modules/mui/packages/cdn/css/mui.min.css']).pipe(gulp.dest('dist/css'));
|
|
});
|
|
|
|
|
|
|
|
gulp.task('index', function() {
|
|
var sources = gulp.src(['js/apps.js', 'css/app.css'], {read: false});
|
|
|
|
return gulp.src(['app/index.html'])
|
|
.pipe(htmlreplace({
|
|
css: 'css/app.css',
|
|
js: 'js/app.js',
|
|
vendor: 'js/vendor.js',
|
|
fonts: 'fonts/fonts.css',
|
|
linear: 'fonts/style.css',
|
|
mui: 'css/mui.min.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','partials','fonts','linearicons','index');
|
|
});
|