forked from TYPO3incubator/surfcamp-team4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
75 lines (67 loc) · 1.81 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const gulp = require('gulp');
const concat = require('gulp-concat');
const terser = require('gulp-terser');
const sourcemaps = require('gulp-sourcemaps');
const {src, dest} = require('gulp');
const minify = require('gulp-minify');
const {watch} = require('gulp');
const concatCss = require('gulp-concat-css');
const sass = require('gulp-sass')(require('sass'));
const esbuild = require('gulp-esbuild');
/**
* Theme Path
*/
const themePath = './local_packages/football/';
/**
* all Js Files
*
* the order of explicit added filenames is important
* if you also use a *-selector the file will not be included twice
*
* @type {string[]}
*/
const jsPath = [
themePath + 'Resources/Private/JavaScript/Src/*.js', //add custom scripts
];
function jsTask() {
return src(jsPath)
.pipe(sourcemaps.init())
.pipe(esbuild({
outfile: 'index.js',
bundle: true
}))
.pipe(terser())
.pipe(sourcemaps.write('.'))
.pipe(minify({
ext: {
min: '.min.js'
},
ignoreFiles: ['-min.js']
}))
.pipe(dest(themePath + 'Resources/Public/JavaScript/'));
}
exports.jsTask = jsTask;
/**
* SCSS compiler
*
* @type {string[]}
*/
const scssSrcFile = themePath + 'Resources/Private/Scss/index.scss';
function scssTask() {
return src(scssSrcFile)
.pipe(sass({
includePaths: ['./node_modules/']
}))
.pipe(sourcemaps.init())
.pipe(concatCss('index.css'))
.pipe(sourcemaps.write('.'))
.pipe(dest(themePath + 'Resources/Public/Css/'))
}
exports.scssTask = scssTask;
/**
* Assets Watcher
*/
exports.watch = function () {
watch(themePath + 'Resources/Private/Scss/**/*.scss', scssTask);
watch(themePath + 'Resources/Private/JavaScript/**/*.js', jsTask);
};