2018-03-23 20:07:17 +01:00
|
|
|
|
/// <binding BeforeBuild='build' Clean='clean' ProjectOpened='build' />
|
|
|
|
|
|
2020-06-11 20:23:23 +02:00
|
|
|
|
const gulp = require('gulp');
|
|
|
|
|
const merge = require('merge-stream');
|
|
|
|
|
const sass = require('gulp-sass');
|
|
|
|
|
const del = require('del');
|
2018-03-23 20:07:17 +01:00
|
|
|
|
|
|
|
|
|
const paths = {};
|
|
|
|
|
paths.webroot = './wwwroot/';
|
|
|
|
|
paths.npmDir = './node_modules/';
|
|
|
|
|
paths.sassDir = './Sass/';
|
|
|
|
|
paths.libDir = paths.webroot + 'lib/';
|
|
|
|
|
paths.cssDir = paths.webroot + 'css/';
|
|
|
|
|
paths.jsDir = paths.webroot + 'js/';
|
|
|
|
|
|
|
|
|
|
paths.sass = paths.sassDir + '**/*.scss';
|
|
|
|
|
paths.minCss = paths.cssDir + '**/*.min.css';
|
|
|
|
|
paths.js = paths.jsDir + '**/*.js';
|
|
|
|
|
paths.minJs = paths.jsDir + '**/*.min.js';
|
|
|
|
|
paths.libJs = paths.libDir + '**/*.js';
|
|
|
|
|
paths.libMinJs = paths.libDir + '**/*.min.js';
|
|
|
|
|
|
2020-06-11 20:23:23 +02:00
|
|
|
|
function clean() {
|
|
|
|
|
return del([paths.minJs, paths.cssDir, paths.libDir]);
|
|
|
|
|
}
|
2018-03-23 20:07:17 +01:00
|
|
|
|
|
2020-06-11 20:23:23 +02:00
|
|
|
|
function lib() {
|
2018-03-23 20:07:17 +01:00
|
|
|
|
const libs = [
|
|
|
|
|
{
|
|
|
|
|
src: paths.npmDir + 'bootstrap/dist/js/*',
|
|
|
|
|
dest: paths.libDir + 'bootstrap/js'
|
|
|
|
|
},
|
|
|
|
|
{
|
2018-09-11 19:29:55 +02:00
|
|
|
|
src: paths.npmDir + 'popper.js/dist/umd/*',
|
2018-03-23 20:07:17 +01:00
|
|
|
|
dest: paths.libDir + 'popper'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
src: paths.npmDir + 'font-awesome/css/*',
|
|
|
|
|
dest: paths.libDir + 'font-awesome/css'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
src: paths.npmDir + 'font-awesome/fonts/*',
|
|
|
|
|
dest: paths.libDir + 'font-awesome/fonts'
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-08-10 18:28:00 +02:00
|
|
|
|
src: paths.npmDir + 'jquery/dist/jquery.*',
|
2018-03-23 20:07:17 +01:00
|
|
|
|
dest: paths.libDir + 'jquery'
|
|
|
|
|
},
|
2021-08-10 18:28:00 +02:00
|
|
|
|
{
|
|
|
|
|
src: paths.npmDir + 'toastr/build/*',
|
|
|
|
|
dest: paths.libDir + 'toastr'
|
|
|
|
|
},
|
2018-03-23 20:07:17 +01:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const tasks = libs.map((lib) => {
|
|
|
|
|
return gulp.src(lib.src).pipe(gulp.dest(lib.dest));
|
|
|
|
|
});
|
|
|
|
|
return merge(tasks);
|
2020-06-11 20:23:23 +02:00
|
|
|
|
}
|
2018-03-23 20:07:17 +01:00
|
|
|
|
|
2020-06-11 20:23:23 +02:00
|
|
|
|
function runSass() {
|
2018-03-23 20:07:17 +01:00
|
|
|
|
return gulp.src(paths.sass)
|
|
|
|
|
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
|
|
|
|
|
.pipe(gulp.dest(paths.cssDir));
|
2020-06-11 20:23:23 +02:00
|
|
|
|
}
|
2018-03-23 20:07:17 +01:00
|
|
|
|
|
2020-06-11 20:23:23 +02:00
|
|
|
|
function sassWatch() {
|
|
|
|
|
gulp.watch(paths.sass, runSass);
|
|
|
|
|
}
|
2018-03-23 20:07:17 +01:00
|
|
|
|
|
2021-09-24 21:55:18 +02:00
|
|
|
|
exports.build = gulp.series(clean, gulp.parallel([lib, runSass]));
|
2020-06-11 20:23:23 +02:00
|
|
|
|
exports['sass:watch'] = sassWatch;
|
|
|
|
|
exports.sass = runSass;
|
|
|
|
|
exports.lib = lib;
|
|
|
|
|
exports.clean = clean;
|