2020-07-02 10:40:34 +02:00
|
|
|
//===
|
|
|
|
// IMPORTS
|
|
|
|
//===
|
|
|
|
const { series, parallel, src, dest, watch } = require('gulp');
|
|
|
|
const sourcemaps = require('gulp-sourcemaps');
|
2020-07-04 16:57:28 +02:00
|
|
|
const uglify = require('gulp-uglify-es').default;
|
2020-07-02 10:40:34 +02:00
|
|
|
const concat = require('gulp-concat');
|
|
|
|
|
|
|
|
//===
|
|
|
|
// VARIABLES
|
|
|
|
//===
|
|
|
|
const SRC_PATH = 'src/';
|
|
|
|
const DIST_PATH = 'dist/';
|
|
|
|
const DIST_JS = 'ffnm.min.js';
|
|
|
|
|
|
|
|
//===
|
|
|
|
// TASKS
|
|
|
|
//===
|
|
|
|
|
|
|
|
// JS concat + sourcemaps + babel + min
|
|
|
|
function js(cb) {
|
2020-08-03 16:43:12 +02:00
|
|
|
return src([
|
|
|
|
SRC_PATH + 'globals.js',
|
|
|
|
SRC_PATH + 'syntax.js',
|
|
|
|
SRC_PATH + 'events/click.js',
|
|
|
|
SRC_PATH + 'events/scroll.js',
|
|
|
|
SRC_PATH + 'events/hover.js',
|
|
|
|
SRC_PATH + 'events/visible.js',
|
|
|
|
SRC_PATH + 'core.js'
|
|
|
|
])
|
2020-07-02 10:40:34 +02:00
|
|
|
.pipe(sourcemaps.init())
|
|
|
|
.pipe(concat(DIST_JS))
|
|
|
|
.pipe(uglify())
|
|
|
|
.pipe(sourcemaps.write('.'))
|
|
|
|
.pipe(dest(DIST_PATH));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//===
|
|
|
|
// Commands
|
|
|
|
//===
|
|
|
|
|
|
|
|
const build = series(js);
|
|
|
|
|
|
|
|
// gulp dev
|
|
|
|
exports.dev = function () {
|
|
|
|
build();
|
|
|
|
watch(SRC_PATH + '*.js', js);
|
|
|
|
}
|
|
|
|
|
|
|
|
// gulp
|
|
|
|
exports.default = build;
|