I recently endeavored to update CamelotHub to Symfony3 and in doing so I abandoned Assetic in place of a more modern gulp approach. All things considered it was actually quite straight forward and certainly less overhead than Assetic.

var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var image = require('gulp-image');

gulp.task('styles', function() {
    gulp.src([
            'src/Litwicki/Bundle/MyBundle/Resources/public/sass/*.scss',
            'src/Litwicki/Bundle/MyBundle/Resources/public/css/common/*.css'
        ])
        .pipe(sass())
        .pipe(minifyCss())
        .pipe(concat('camelot.css'))
        .pipe(gulp.dest('web/assets/css'));
});

gulp.task('javascripts', function() {
    gulp.src([
            'src/Litwicki/Bundle/MyBundle/Resources/public/js/*.js',
        ])
        .pipe(concat('camelot.js'))
        .pipe(gulp.dest('web/assets/js'));
});

gulp.task('images', function() {
    gulp.src([
            'src/Litwicki/Bundle/MyBundle/Resources/public/img/*',
            'src/Litwicki/Bundle/MyBundle/Resources/public/img/*/*'
        ])
        .pipe(image())
        .pipe(gulp.dest('web/assets/img'));
});

gulp.task('default', ['styles', 'javascripts', 'images']);

Once complete, execution is as simple as running the command gulp from the directory your gulpfile.js lives.


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *