You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.2 KiB
64 lines
2.2 KiB
/**
|
|
* @author Robert Strutts <Robert@TryingToScale.com>
|
|
* @copyright Copyright (c) 2022, Robert Strutts.
|
|
* @license https://mit-license.org/
|
|
*/
|
|
|
|
/* My Plug-Ins */
|
|
const extend = require('./gulp_deps/gulp-extend');
|
|
const when = require('./gulp_deps/gulp-when');
|
|
const combine = require('./gulp_deps/gulp-combine');
|
|
/* Terser Ugilfy Settings */
|
|
const ecma_latest = 8;
|
|
const warn_level = { warnings: true };
|
|
const compress = { compress: { dead_code: true, drop_debugger: false, arrows: false, properties: false } };
|
|
const mangle = { mangle: false }; // { properties: { keep_quoted: true } }
|
|
const output = { output: {comments: false} }; // Destroy Commment Blocks!
|
|
const options = { module: false, keep_classnames: true, keep_fnames: true, toplevel: false, safari10: false };
|
|
const common = extend( warn_level, compress, mangle, options, output );
|
|
const uglify_latest_e = { ecma: ecma_latest, ie8: false };
|
|
const uglify_latest = extend( uglify_latest_e, common );
|
|
/* Gulp Add-Ons */
|
|
const { src, dest, series, parallel, watch } = require('gulp');
|
|
const uglify = require('gulp-terser');
|
|
const concat = require('gulp-concat');
|
|
const rename = require('gulp-rename');
|
|
const sourcemaps = require("gulp-sourcemaps");
|
|
/* Core TTS JS */
|
|
const tts_js_files = [
|
|
'core/begin.js',
|
|
'core/core.js',
|
|
'core/addons/*.js',
|
|
'core/end.js'
|
|
];
|
|
/* Destination Folders for JS */
|
|
const js_dest = 'assets/dist/';
|
|
/* Use Map instead of .js.map */
|
|
const map = { mapFile: function(mapFilePath) { return mapFilePath.replace('.js.map', '.map'); } };
|
|
|
|
function tts_js() {
|
|
return when([
|
|
new Promise(function(resolve, reject) {
|
|
src( tts_js_files )
|
|
.pipe(sourcemaps.init({ loadMaps: true }))
|
|
.pipe(concat( 'tts.js' ))
|
|
.pipe(dest( js_dest ))
|
|
.pipe(rename( { extname: '.min.js' } ))
|
|
.pipe(uglify( uglify_latest ) )
|
|
.pipe(sourcemaps.write(".", map ))
|
|
.pipe(dest( js_dest ))
|
|
.on('end', resolve);
|
|
})
|
|
]);
|
|
}
|
|
|
|
function watch_js() {
|
|
watch(tts_js_files, tts_js);
|
|
}
|
|
|
|
exports.js = parallel(tts_js);
|
|
exports.all = parallel(tts_js);
|
|
exports.watcher = series( parallel(tts_js), watch_js );
|
|
//exports.css = css;
|
|
//exports.html = html;
|
|
exports.default = parallel(tts_js);
|
|
|