mirror of
https://github.com/netzmacht/contao-leaflet-libraries.git
synced 2025-11-28 02:54:12 +01:00
Switch to gulp v4.
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -16,6 +16,10 @@ nbproject/
|
||||
vendor/
|
||||
composer.lock
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
package-lock.json
|
||||
|
||||
# build
|
||||
build/
|
||||
build.properties
|
||||
|
||||
45
gulpfile.js
45
gulpfile.js
@@ -1,4 +1,5 @@
|
||||
var gulp = require('gulp');
|
||||
const { series, parallel, src, dest } = require('gulp');
|
||||
|
||||
var del = require('del');
|
||||
var rename = require('gulp-rename');
|
||||
var uglify = require('gulp-uglify');
|
||||
@@ -29,14 +30,10 @@ var paths = [
|
||||
dest: 'assets/leaflet-fullscreen',
|
||||
css: 'Control.FullScreen.css',
|
||||
js: 'Control.FullScreen.js'
|
||||
},
|
||||
{
|
||||
dest: 'assets/leaflet-layer-overpass',
|
||||
css: 'OverPassLayer.css'
|
||||
}
|
||||
];
|
||||
|
||||
gulp.task('clear-styles', function() {
|
||||
function clearStyles (cb) {
|
||||
var i, clear = [];
|
||||
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
@@ -46,9 +43,11 @@ gulp.task('clear-styles', function() {
|
||||
}
|
||||
|
||||
del(clear);
|
||||
});
|
||||
|
||||
gulp.task('clear-scripts', function() {
|
||||
cb();
|
||||
}
|
||||
|
||||
function clearScripts (cb) {
|
||||
var i, clear = [];
|
||||
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
@@ -58,45 +57,53 @@ gulp.task('clear-scripts', function() {
|
||||
}
|
||||
|
||||
del(clear);
|
||||
});
|
||||
|
||||
gulp.task('scripts', ['clear-scripts'], function() {
|
||||
cb();
|
||||
}
|
||||
|
||||
const scripts = series(clearScripts, function (cb) {
|
||||
var i, stream, streams = [];
|
||||
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
if (paths[i].js) {
|
||||
stream = gulp.src(paths[i].dest + '/' + paths[i].js)
|
||||
stream = src(paths[i].dest + '/' + paths[i].js)
|
||||
.pipe(rename(function (path) {
|
||||
path.basename += '.min';
|
||||
}))
|
||||
.pipe(uglify())
|
||||
.pipe(gulp.dest(paths[i].dest));
|
||||
.pipe(dest(paths[i].dest));
|
||||
|
||||
streams.push(stream);
|
||||
}
|
||||
}
|
||||
|
||||
return merge.call(null, streams);
|
||||
merge.call(null, streams);
|
||||
|
||||
cb();
|
||||
});
|
||||
|
||||
gulp.task('styles', ['clear-styles'], function() {
|
||||
const styles = series(clearStyles, function (cb) {
|
||||
var i, stream, streams = [];
|
||||
|
||||
for (i = 0; i < paths.length; i++) {
|
||||
if (paths[i].css) {
|
||||
stream = gulp.src(paths[i].dest + '/' + paths[i].css)
|
||||
stream = src(paths[i].dest + '/' + paths[i].css)
|
||||
.pipe(rename(function (path) {
|
||||
path.basename += '.min';
|
||||
}))
|
||||
.pipe(minifyCss())
|
||||
.pipe(replace(/url\(([^"][^\)]+)\)/g, 'url(\'$1\')'))
|
||||
.pipe(gulp.dest(paths[i].dest));
|
||||
.pipe(dest(paths[i].dest));
|
||||
|
||||
streams.push(stream);
|
||||
}
|
||||
}
|
||||
|
||||
return merge.call(null, streams);
|
||||
});
|
||||
merge.call(null, streams);
|
||||
|
||||
gulp.task('default', ['scripts', 'styles']);
|
||||
cb();
|
||||
})
|
||||
|
||||
exports.scripts = scripts;
|
||||
exports.styles = styles;
|
||||
exports.default = parallel(scripts, styles);
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
"main": "gulpfile.js",
|
||||
"dependencies": {
|
||||
"del": "^2.2.2",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-minify-css": "^1.2.4",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-replace": "^0.5.4",
|
||||
"gulp-uglify": "^2.0.0",
|
||||
"gulp-util": "^3.0.7",
|
||||
"merge-stream": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {},
|
||||
|
||||
Reference in New Issue
Block a user