gulp-include icon indicating copy to clipboard operation
gulp-include copied to clipboard

Implement Type Handlers

Open AlicanC opened this issue 11 years ago • 1 comments

Example file:

//= require handler=json src/json/myJSON.json

Example build process:

gulp.src([
    'src/js/file.src.js',
    ])
    .pipe(include({
        typeHandlers: {
            json: function (fileContent) {
                return 'list.push(JSON.parse("'+escapeJSON(fileContent)+'"));';
            }
        }
    }))
    .pipe(rename('file.js'))
    .pipe(gulp.dest('assets/js/'));

My current method for inserting JSON:

list.push(
//= require src/json/myJSON.json
);

//Pray that it works

AlicanC avatar Aug 13 '14 16:08 AlicanC

Ditto, this would be a great addition to this package. I would use this feature immediately.

KenEucker avatar Aug 30 '18 00:08 KenEucker