Skip to content
Snippets Groups Projects
Commit cd1120bf authored by jurgenhaas's avatar jurgenhaas
Browse files

#7 Update gulpfile for new syntax in composer.json and also add JS handling

parent ef402a1f
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ var gulp = require('gulp'),
config = {
cssPath: './css',
fontsPath: './fonts',
jsPath: './js',
sassPath: './sass'
},
knownOptions = {
......@@ -18,16 +19,31 @@ var gulp = require('gulp'),
},
options = minimist(process.argv.slice(2), knownOptions);
{% for package, font in bower_assets.fonts %}
// Provide fonts from {{ package }}
gulp.task('fonts-{{ package }}', function() {
return gulp.src('{{ font.src }}/**.*')
.pipe(gulp.dest(config.fontsPath + '/{{ font.dest }}'));
{% for name, package in bower_assets %}
{% if package.fonts is defined %}
// Provide fonts from {{ name }}
gulp.task('fonts-{{ name }}', function() {
return gulp.src('{{ package.fonts.relative }}/**.*')
.pipe(gulp.dest(config.fontsPath + '/{{ name }}'));
});
{% endif %}
{% endfor %}
// Provide fonts from all libraries
gulp.task('fonts', [{% for package, font in bower_assets.fonts %}'fonts-{{ package }}', {% endfor %}]);
gulp.task('fonts', [{% for name, package in bower_assets %}{% if package.fonts is defined %}'fonts-{{ name }}', {% endif %}{% endfor %}]);
{% for name, package in bower_assets %}
{% if package.js is defined %}
// Provide JS from {{ name }}
gulp.task('js-{{ name }}', function() {
return gulp.src('{{ package.js.relative }}/**.*')
.pipe(gulp.dest(config.jsPath + '/{{ name }}'));
});
{% endif %}
{% endfor %}
// Provide JS from all libraries
gulp.task('js', [{% for name, package in bower_assets %}{% if package.js is defined %}'js-{{ name }}', {% endif %}{% endfor %}]);
// Pre-process CSS
gulp.task('css', function() {
......@@ -37,8 +53,10 @@ gulp.task('css', function() {
outputStyle:gulpif(options.env !== 'production', 'nested', 'compressed'),
includePaths:[
config.sassPath,
{% for sass in bower_assets.sass %}
'{{ sass.src }}',
{% for name, package in bower_assets %}
{% if package.sass is defined %}
'{{ package.sass.relative }}',
{% endif %}
{% endfor %}
]})
.on("error", notify.onError(function (error) {
......@@ -54,4 +72,4 @@ gulp.task('watch', function() {
});
// Default task: run all other tasks in the correct order
gulp.task('default', ['fonts', 'css']);
gulp.task('default', ['fonts', 'js', 'css']);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment