123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- const gulp = require('gulp'),
- concat = require("gulp-concat"),
- rename = require("gulp-rename"),
- cleanCSS = require('gulp-clean-css'),
- uglify = require('gulp-uglify'),
- terser = require('gulp-terser'),
- sass = require('gulp-sass')(require('sass')),
- streamqueue = require('streamqueue');
- browserSync = require('browser-sync').create();
- function copy(cb) {
- gulp.src('./node_modules/bootstrap/dist/js/bootstrap.bundle.js')
- .pipe(rename('v4-bootstrap.js'))
- .pipe(gulp.dest('./js/'));
- gulp.src('./node_modules/bootstrap/dist/js/bootstrap.bundle.js.map')
- .pipe(gulp.dest('./js/'));
- gulp.src('./node_modules/jquery/dist/jquery.min.js')
- .pipe(rename('v4-jquery.js'))
- .pipe(gulp.dest('./js/'));
- gulp.src('./node_modules/animate.css/animate.css')
- .pipe(rename('v4-animate.css'))
- .pipe(gulp.dest('./css/'));
- gulp.src('./node_modules/svg-morpheus/compile/minified/svg-morpheus.js')
- .pipe(rename('v4-svg-morpheus.js'))
- .pipe(gulp.dest('./js/'));
- gulp.src('./node_modules/fullcalendar/main.js')
- .pipe(rename('v4-fullcalendar.js'))
- .pipe(gulp.dest('./js/', { overwrite:true } ));
- gulp.src('./node_modules/fullcalendar/main.css')
- .pipe(rename('v4-fullcalendar.css'))
- .pipe(gulp.dest('./css/', { overwrite:true } ));
- console.log("files 📄 from npm pkgs ");
- cb();
- }
- function build(cb) {
- return streamqueue({ objectMode: true },
- gulp.src('./css/fonts.css'),
- gulp.src('./css/v4-animate.css'),
- gulp.src('./css/v4-fullcalendar.css'),
- gulp.src('./css/styles.css'),
- gulp.src('./style.css')
- )
- .pipe(concat('v4-style.css'))
- .pipe(cleanCSS({level: {1: {specialComments: 0}}}))
- .pipe(rename('v4-style.min.css'))
- .pipe(gulp.dest('./', { overwrite:true })),
- console.log("Build 🔧 "),
- cb();
- }
- function cssf(cb) {
- gulp.src('css/front-page.css')
- .pipe(cleanCSS({level: {1: {specialComments: 0}}}))
- .pipe(rename('v4-front.min.css'))
- .pipe(gulp.dest('./css/', { overwrite:true })),
- console.log("CSS Front built 🔧 "),
- cb();
- }
- function js(cb) {
- return streamqueue({ objectMode: true },
- gulp.src('./js/v4-jquery.js'),
- gulp.src('./js/v4-bootstrap.js'),
- gulp.src('./js/v4-fullcalendar.js'),
- gulp.src('./js/modernizr.js'),
- gulp.src('./js/validate.js'),
- gulp.src('./js/scripts.js')
- )
- .pipe(terser({ output: {comments: false} }))
- .pipe(concat('v4-script.min.js'))
- .pipe(gulp.dest('./js/', { overwrite:true })),
- console.log("JS built 🔧 "),
- cb();
- }
- function jsf(cb) {
- return streamqueue({ objectMode: true },
- gulp.src('./js/v4-jquery.js'),
- gulp.src('./js/svg-morpheus.js'),
- gulp.src('./js/messenger.min.js'),
- gulp.src('./js/v4-bootstrap.js'),
- gulp.src('./js/terminal.js'),
- gulp.src('./js/front-page.js')
- )
- .pipe(concat('v4-front.js'))
- .pipe(terser({ output: {comments: false} }))
- .pipe(rename('v4-front.min.js'))
- .pipe(gulp.dest('./js/', { overwrite:true })),
- console.log("JSF built 🔧 "),
- cb();
- }
- function mixin(cb) {
- return gulp.src('./css/**/*.scss')
- .pipe(sass().on('error',sass.logError))
- .pipe(gulp.dest('./css/'))
- .pipe(browserSync.stream()),
- console.log("Mixin 🎨"),
- cb();
- }
- function reload(cb) {
- browserSync.reload();
- cb();
- }
- function run() {
- browserSync.init({
- open: 'external',
- host: 'daw.ovid',
- proxy: 'https://daw.ovid',
- port: '333',
- ssl: {
- key: '/opt/homebrew/etc/httpd/ssl/daw.ovid-key.pem',
- cert: '/opt/homebrew/etc/httpd/ssl/daw.ovid.pem'
- }
- });
- gulp.watch(['./style.css', './css/*.scss',]).on('change', gulp.series(mixin, build));
- gulp.watch(['./**/*.php', './**/*.js', './**/*.css']).on('change', gulp.series(reload));
- console.log("🔥 Run");
- }
- exports.copy = copy;
- exports.build = build;
- exports.cssf = cssf;
- exports.js = js;
- exports.jsf = jsf;
- exports.mixin = mixin;
- exports.run = run;
|