iwmlib/gulpfile.js

73 lines
2.6 KiB
JavaScript
Raw Permalink Normal View History

2019-07-16 15:10:15 +02:00
const { src, dest, parallel } = require('gulp')
const uglify = require('gulp-uglify')
const rename = require('gulp-rename')
const concat = require('gulp-concat')
const replace = require('gulp-replace')
2019-07-18 12:26:39 +02:00
const prettier = require('gulp-prettier')
2019-03-22 13:48:42 +01:00
function vendors() {
2019-07-16 15:10:15 +02:00
return src(
[
'./node_modules/optimal-select/dist/optimal-select.js',
'./node_modules/hammerjs/hammer.js',
'./node_modules/propagating-hammerjs/propagating.js',
'./node_modules/pixi.js/dist/browser/pixi.js',
'./node_modules/pixi-compressed-textures/lib/crn_decomp.js',
'./node_modules/pixi-compressed-textures/dist/pixi-compressed-textures.js',
2019-07-16 15:10:15 +02:00
'./node_modules/pixi-filters/dist/pixi-filters.js',
'./node_modules/pixi-particles/dist/pixi-particles.js',
2022-10-04 10:51:35 +02:00
'./node_modules/pixi-projection/dist/pixi-projection.umd.js',
2019-07-16 15:10:15 +02:00
'./node_modules/gsap/src/uncompressed/TweenMax.js',
'./node_modules/gsap/src/uncompressed/TimelineMax.js',
'./lib/3rdparty/jquery.js',
2019-07-16 15:10:15 +02:00
'./lib/3rdparty/pixi-ease.js',
'./lib/3rdparty/pixi-viewport.js',
'./lib/3rdparty/convertPointFromPageToNode.js',
2019-07-18 08:40:48 +02:00
'./lib/3rdparty/jquery.hypher.js',
'./lib/3rdparty/hyphenation/de.js',
2019-07-18 08:40:48 +02:00
'./lib/3rdparty/hyphenation/en-gb.js'
2019-07-16 15:10:15 +02:00
],
{ sourcemaps: false }
)
.pipe(concat('iwmlib.3rdparty.js'))
2019-07-16 15:10:15 +02:00
.pipe(replace(/^\/\/# sourceMappingURL=.*$/gim, ''))
.pipe(dest('dist', { sourcemaps: false }))
.pipe(rename({ extname: '.min.js' }))
2019-03-22 13:48:42 +01:00
.pipe(uglify())
2019-07-16 15:10:15 +02:00
.pipe(dest('dist', { sourcemaps: false }))
2019-03-22 13:48:42 +01:00
}
function preload() {
2019-08-02 11:39:56 +02:00
return src(['./node_modules/gsap/src/uncompressed/TweenMax.js', './lib/3rdparty/convertPointFromPageToNode.js'], {
sourcemaps: false
})
.pipe(concat('iwmlib.3rdparty.preload.js'))
2019-07-16 15:10:15 +02:00
.pipe(replace(/^\/\/# sourceMappingURL=.*$/gim, ''))
.pipe(dest('dist', { sourcemaps: false }))
.pipe(rename({ extname: '.min.js' }))
.pipe(uglify())
2019-07-16 15:10:15 +02:00
.pipe(dest('dist', { sourcemaps: false }))
}
2019-07-18 12:26:39 +02:00
function prettify() {
2019-08-06 15:34:57 +02:00
return src(
['./lib/*.js', './lib/card/*.js', './lib/pixi/*.js', './lib/pixi/deepzoom/*.js', '!./lib/bootstrap.babel.js'],
{
base: './lib'
}
)
2019-07-18 12:26:39 +02:00
.pipe(
prettier({
singleQuote: true,
jsxSingleQuote: true,
tabWidth: 4,
semi: false,
printWidth: 120
2019-07-18 12:26:39 +02:00
})
)
.pipe(dest('./lib'))
}
exports.prettify = prettify
2019-07-16 15:10:15 +02:00
exports.default = parallel(vendors, preload)