Skip to content
Snippets Groups Projects
Commit f43c24ea authored by Felix Häberle's avatar Felix Häberle
Browse files

add support for gulp v4

parent 30fce178
Branches
Tags
1 merge request!1add support for gulp v4
...@@ -21,8 +21,12 @@ var autoprefixer = require('autoprefixer'), ...@@ -21,8 +21,12 @@ var autoprefixer = require('autoprefixer'),
}, },
options = minimist(process.argv.slice(2), knownOptions); options = minimist(process.argv.slice(2), knownOptions);
{# This variable is needed to search for defined fonts in packages #}
{% set fontDefined = false %}
{% for name, package in bower_assets %} {% for name, package in bower_assets %}
{% if package.fonts is defined %} {% if package.fonts is defined %}
{% set fontDefined = true %}
// Provide fonts from {{ name }} // Provide fonts from {{ name }}
gulp.task('fonts-{{ package.name }}', function() { gulp.task('fonts-{{ package.name }}', function() {
return gulp.src('{{ package.fonts.relative }}/**') return gulp.src('{{ package.fonts.relative }}/**')
...@@ -32,7 +36,7 @@ gulp.task('fonts-{{ package.name }}', function() { ...@@ -32,7 +36,7 @@ gulp.task('fonts-{{ package.name }}', function() {
{% endif %} {% endif %}
{% endfor %} {% endfor %}
// Provide fonts from all libraries // Provide fonts from all libraries
gulp.task('fonts', [{% for name, package in bower_assets %}{% if package.fonts is defined %}'fonts-{{ package.name }}', {% endif %}{% endfor %}]); gulp.task('fonts', {% if fontDefined %}gulp.series(gulp.parallel({% for name, package in bower_assets %}{% if package.fonts is defined %}'fonts-{{ package.name }}', {% endif %}{% endfor %})){% endif %});
{% for name, package in bower_assets %} {% for name, package in bower_assets %}
{% if package.js is defined %} {% if package.js is defined %}
...@@ -45,7 +49,7 @@ gulp.task('js-{{ package.name }}', function() { ...@@ -45,7 +49,7 @@ gulp.task('js-{{ package.name }}', function() {
{% endif %} {% endif %}
{% endfor %} {% endfor %}
// Provide JS from all libraries // 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', {% if fontDefined %}gulp.series(gulp.parallel({% for name, package in bower_assets %}{% if package.js is defined %}'js-{{ package.name }}', {% endif %}{% endfor %})){% endif %});
// Pre-process CSS // Pre-process CSS
gulp.task('css', function() { gulp.task('css', function() {
...@@ -72,8 +76,8 @@ gulp.task('css', function() { ...@@ -72,8 +76,8 @@ gulp.task('css', function() {
// Rerun the task when a file changes // Rerun the task when a file changes
gulp.task('watch', function() { 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 // Default task: run all other tasks in the correct order
gulp.task('default', ['fonts', 'js', 'css']); gulp.task('default', gulp.series(gulp.parallel('fonts', 'js', 'css')));
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
}, },
"dependencies": { "dependencies": {
"autoprefixer": "^7.1.1", "autoprefixer": "^7.1.1",
"gulp": "^3.9.0", "gulp": "^4.0.0",
"gulp-if": "^2.0.0", "gulp-if": "^2.0.0",
"gulp-notify": "^2.2.0", "gulp-notify": "^2.2.0",
"gulp-postcss": "^7.0.0", "gulp-postcss": "^7.0.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment