Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Type Handlers #22

Open
AlicanC opened this issue Aug 13, 2014 · 1 comment
Open

Implement Type Handlers #22

AlicanC opened this issue Aug 13, 2014 · 1 comment

Comments

@AlicanC
Copy link

AlicanC commented Aug 13, 2014

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
@KenEucker
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants