Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 696 Bytes

custom-classes.md

File metadata and controls

30 lines (23 loc) · 696 Bytes

Custom classes

var gulp = require('gulp');
var imageDataURI = require('gulp-image-data-uri');
var path = require('path');

gulp.task('prepare', function() {
    gulp.src('./images/*')
        .pipe(imageDataURI({
            customClass: function(className, file){
                var customClass = 'icons-' + className; // add prefix

                // add suffix if the file is a GIF
                if(path.extname(file.path) === '.gif'){
                    customClass += '-gif';
                }

                return customClass;
            }
        ))
        .pipe(gulp.dest('./dist'));
});

gulp.task('default', ['prepare']);

Back to readme