7b94313f90
options.error/debug to options.boot
79 lines
2 KiB
JavaScript
79 lines
2 KiB
JavaScript
|
|
var gulp = require('gulp');
|
|
var uglify = require('gulp-uglify');
|
|
var rename = require('gulp-rename');
|
|
var clean = require('gulp-clean');
|
|
var srcmaps = require('gulp-sourcemaps');
|
|
var jsdoc = require('gulp-jsdoc3');
|
|
var cssnano = require('gulp-cssnano');
|
|
var karma = require('karma');
|
|
var testServer = require('./test/test-server.js');
|
|
var srcPath = './';
|
|
var srcFile = 'es5-ff-spa-loader.js';
|
|
var srcCss = 'es5-ff-spa-loader.css';
|
|
var distPathJS = 'dist/js';
|
|
var distPathCSS = 'dist/css';
|
|
var testSrc = 'test/*.js';
|
|
|
|
gulp.task('clean', function() {
|
|
return gulp.src('dist').pipe(clean());
|
|
});
|
|
|
|
gulp.task('buildScript', ['test'], function() {
|
|
return gulp.src(srcFile, {cwd: srcPath}).pipe(gulp.dest(distPathJS));
|
|
});
|
|
|
|
gulp.task('buildScriptMin', ['buildScript'], function() {
|
|
return gulp.src(srcFile, {cwd: srcPath})
|
|
.pipe(srcmaps.init())
|
|
.pipe(uglify({/*preserveComments: 'license'*/}))
|
|
.pipe(rename({ extname: '.min.js' }))
|
|
.pipe(srcmaps.write('.'))
|
|
.pipe(gulp.dest(distPathJS));
|
|
});
|
|
|
|
gulp.task('buildCss', ['test'], function() {
|
|
return gulp.src(srcCss, {cwd: srcPath}).pipe(gulp.dest(distPathCSS));
|
|
});
|
|
|
|
gulp.task('buildCssMin',['buildCss'], function () {
|
|
return gulp.src(srcCss, {cwd: srcPath})
|
|
.pipe(srcmaps.init())
|
|
.pipe(cssnano())
|
|
.pipe(rename({ extname: '.min.css' }))
|
|
.pipe(srcmaps.write('.'))
|
|
.pipe(gulp.dest(distPathCSS));
|
|
});
|
|
|
|
gulp.task('testKarma',['clean'], function (done) {
|
|
return testServer.start(function () {
|
|
new karma.Server({
|
|
configFile: __dirname + '/test/karma.conf.js',
|
|
singleRun: true
|
|
}, function(exitCode) {
|
|
console.log('Karma exit code:', exitCode);
|
|
//done();
|
|
testServer.stop(done);
|
|
}).start();
|
|
});
|
|
});
|
|
|
|
gulp.task('buildJSDoc', function (cb) {
|
|
var jsdocConfig = {
|
|
opts: {
|
|
destination: 'dist/jsdoc',
|
|
encoding: 'utf8',
|
|
access: 'all'
|
|
},
|
|
templates: {
|
|
cleverLinks: true
|
|
}
|
|
};
|
|
return gulp.src(srcFile, {read: false}).pipe(jsdoc(jsdocConfig, cb));
|
|
});
|
|
|
|
gulp.task('test', ['testKarma']);
|
|
gulp.task('build', ['test','buildCssMin','buildScriptMin'/*,'buildJSDoc'*/]);
|
|
|
|
|