Commit 3725e30c authored by Jürgen Haas's avatar Jürgen Haas

Merge branch 'update-gulp-v4' into 'master'

add support for gulp v4

See merge request !1
parents 30fce178 f558762d
......@@ -20,32 +20,42 @@ var autoprefixer = require('autoprefixer'),
default: { env: process.env.NODE_ENV || 'development' }
},
options = minimist(process.argv.slice(2), knownOptions);
{# This variable is needed to search for defined fonts in packages #}
{% set fontDefined = [] %}
{% for name, package in bower_assets %}
{% if package.fonts is defined %}
{% set fontDefined = fontDefined|merge([package.name]) %}
// Provide fonts from {{ name }}
gulp.task('fonts-{{ package.name }}', function() {
return gulp.src('{{ package.fonts.relative }}/**')
.pipe(gulp.dest(config.fontsPath + '/{{ package.name }}'));
});
{% endif %}
{% endfor %}
// Provide fonts from all libraries
gulp.task('fonts', [{% for name, package in bower_assets %}{% if package.fonts is defined %}'fonts-{{ package.name }}', {% endif %}{% endfor %}]);
{% if fontDefined|length %}
// Provide fonts from all libraries
gulp.task('fonts', gulp.parallel('fonts-{{ jsDefined|join("','fonts-") }}'));
{% endif %}
{# This variable is needed to search for defined js in packages #}
{% set jsDefined = [] %}
{% for name, package in bower_assets %}
{% if package.js is defined %}
{% set jsDefined = jsDefined|merge([package.name]) %}
// Provide JS from {{ name }}
gulp.task('js-{{ package.name }}', function() {
return gulp.src('{{ package.js.relative }}/**')
.pipe(gulp.dest(config.jsPath + '/{{ package.name }}'));
});
{% endif %}
{% endfor %}
{% if jsDefined|length %}
// Provide JS from all libraries
gulp.task('js', [{% for name, package in bower_assets %}{% if package.js is defined %}'js-{{ package.name }}', {% endif %}{% endfor %}]);
gulp.task('js', gulp.parallel('js-{{ jsDefined|join("','js-") }}'));
{% endif %}
// Pre-process CSS
gulp.task('css', function() {
......@@ -72,8 +82,8 @@ gulp.task('css', function() {
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(config.sassPath + '/**/*.scss', ['css']);
gulp.watch(config.sassPath + '/**/*.scss', gulp.parallel('css'));
});
// Default task: run all other tasks in the correct order
gulp.task('default', ['fonts', 'js', 'css']);
gulp.task('default', gulp.parallel({% if fontDefined|length %}'fonts', {% endif %}{% if jsDefined|length %}'js', {% endif %}'css'));
......@@ -5,7 +5,7 @@
},
"dependencies": {
"autoprefixer": "^7.1.1",
"gulp": "^3.9.0",
"gulp": "^4.0.0",
"gulp-if": "^2.0.0",
"gulp-notify": "^2.2.0",
"gulp-postcss": "^7.0.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment