mirror of
https://gitlab.silvrtree.co.uk/martind2000/feedmaster-core.git
synced 2025-01-10 21:35:07 +00:00
170 lines
4.8 KiB
JavaScript
170 lines
4.8 KiB
JavaScript
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 stripDebug = require('gulp-strip-debug');
|
|
var scss = require('gulp-scss');
|
|
var sass = require('gulp-sass');
|
|
var googleWebFonts = require('gulp-google-webfonts');
|
|
|
|
|
|
var filePath = {
|
|
build_dir: './dist'
|
|
};
|
|
|
|
var fontOptions = { };
|
|
|
|
gulp.task('appJS', function() {
|
|
return gulp.src(['app/js/mandecoder.js','app/js/index.js'])
|
|
.pipe(stripDebug())
|
|
.pipe(jshint('.jshintrc'))
|
|
.pipe(jshint.reporter('default'))
|
|
.pipe(concat('app.js'))
|
|
/*.pipe(gulp.dest('dist/js'))*/
|
|
/*.pipe(rename({suffix: '.min'}))*/
|
|
.pipe(uglify({mangle: false}))
|
|
/*.pipe(concat('app.js'))*/
|
|
.pipe(gulp.dest('www/js'));
|
|
});
|
|
|
|
gulp.task('cc2650', function() {
|
|
return gulp.src(['app/js/device/CC2650/**/*'])
|
|
.pipe(stripDebug())
|
|
.pipe(jshint('.jshintrc'))
|
|
.pipe(jshint.reporter('default'))
|
|
.pipe(concat('cc2650.js'))
|
|
/*.pipe(gulp.dest('dist/js'))*/
|
|
/*.pipe(rename({suffix: '.min'}))*/
|
|
.pipe(uglify({mangle: false}))
|
|
/*.pipe(concat('app.js'))*/
|
|
.pipe(gulp.dest('www/js'));
|
|
});
|
|
|
|
gulp.task('devices', function() {
|
|
return gulp.src(['app/js/standards/bluetooth_company_identifiers.js','app/js/standards/capability.js','app/js/standards/battery.js','app/js/standards/button.js'])
|
|
.pipe(stripDebug())
|
|
.pipe(jshint('.jshintrc'))
|
|
.pipe(jshint.reporter('default'))
|
|
.pipe(concat('standards.js'))
|
|
/*.pipe(gulp.dest('dist/js'))*/
|
|
/*.pipe(rename({suffix: '.min'}))*/
|
|
.pipe(uglify({mangle: false}))
|
|
/*.pipe(concat('app.js'))*/
|
|
.pipe(gulp.dest('www/js'));
|
|
});
|
|
|
|
gulp.task('vendor', function() {
|
|
return gulp.src(['app/libs/jquery/dist/jquery.min.js',
|
|
'app/libs/mui/packages/cdn/js/mui.min.js'])
|
|
.pipe(concat('vendor.js'))
|
|
.pipe(uglify({mangle: false}))
|
|
.pipe(gulp.dest('www/libs'));
|
|
});
|
|
|
|
|
|
gulp.task('mui', function() {
|
|
return gulp.src(['app/css/custom.scss'])
|
|
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
|
//.pipe(cssnano())
|
|
.pipe(gulp.dest('www/css'));
|
|
});
|
|
|
|
gulp.task('customMUI', function() {
|
|
return gulp.src(['app/css/custom.scss'])
|
|
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
|
//.pipe(cssnano())
|
|
.pipe(rename('mui.custom.css'))
|
|
.pipe(gulp.dest('app/css'));
|
|
});
|
|
|
|
gulp.task('styles', function() {
|
|
return gulp.src(['app/css/app.css','app/css/progress.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('www/css'));
|
|
});
|
|
|
|
gulp.task('fonts', function() {
|
|
return gulp.src('./fonts.list')
|
|
.pipe(googleWebFonts(fontOptions))
|
|
.pipe(gulp.dest('www/fonts'))
|
|
;
|
|
});
|
|
|
|
gulp.task('index', function() {
|
|
|
|
return gulp.src(['app/index.html'])
|
|
.pipe(htmlreplace({
|
|
mui: 'css/custom.css',
|
|
css: 'css/app.css',
|
|
js: 'js/app.js',
|
|
vendor: 'libs/vendor.js',
|
|
fonts: 'fonts/fonts.css',
|
|
standards: 'js/standards.js',
|
|
cc2650: 'js/cc2650.js'
|
|
|
|
}))
|
|
.pipe(htmlmin({removeComments: true, collapseWhitespace: true, keepClosingSlash: true}))
|
|
|
|
.pipe(gulp.dest('www/'));
|
|
});
|
|
|
|
|
|
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.src(['app/libs/microevent.js']).pipe(gulp.dest('dist/libs'));
|
|
//gulp.src(['app/fav/**/*']).pipe(size({title: 'Partials'})).pipe(gulp.dest('dist/fav'));
|
|
gulp.src(['app/img/logo.png']).pipe(gulp.dest('www/img'));
|
|
});
|
|
|
|
gulp.task('copy', function() {
|
|
return gulp.src(['app/**/*'])
|
|
.pipe(gulp.dest('www'));
|
|
});
|
|
|
|
gulp.task('buildJS', function() {
|
|
gulp.start('appJS','cc2650','devices','vendor');
|
|
});
|
|
|
|
gulp.task('clean', function() {
|
|
return del(['www']);
|
|
});
|
|
|
|
|
|
gulp.task('normal', ['clean'], function() {
|
|
'use strict';
|
|
gulp.start('copy','watch');
|
|
});
|
|
|
|
gulp.task('default', ['clean'], function() {
|
|
gulp.start('buildJS','mui','styles','fonts', 'index', 'partials');
|
|
});
|
|
|
|
gulp.task('watch',function() {
|
|
gulp.watch('app/**/*',['copy']);
|
|
|
|
});
|
|
|
|
gulp.task('MUIWatcher', function() {
|
|
'use strict';
|
|
gulp.start('customMUI','watchMUI');
|
|
});
|
|
|
|
gulp.task('watchMUI',function() {
|
|
gulp.watch('app/css/custom.scss',['customMUI']);
|
|
|
|
});
|