Neighborly Package Megalodon

    gulp-js-to-json

    1.1.2 • Public • Published

    gulp-js-to-json

    Install with npm install gulp-js-to-json

    Accepts require-able javascript files, and attempts to stringify them as JSON.

    Example

    src (sample/sample.js):

    module.exports = {
        'this': ['that','I','Can','be', 'executed'].join('\n'),
        tabs:['*tab','*tab',['*space', '*space'].join(' ')].join('\n'),
        complex:'this is ' +
        'my stuff' +
        'more ' +
        'words ' +
        'yo '
    }

    gulp task:

    gulp.task('2JSON', function(){
       return gulp.src('sample/**/*.js', {read: false})
           .pipe(toJSON({
               stringify:{
                   replacer: miscReplacer,
                   space: '\t'
               }
           }))
           .pipe(gulp.dest('sample'));
    });

    result (sample/sample.json):

    {"this":"that\nI\nCan\nbe\nexecuted","tabs":"*tab\n*tab\n*space *space","complex":"this is my stuffmore words yo "}

    Test

    Run tests with mocha test test/

    Keywords

    none

    Install

    npm i gulp-js-to-json

    DownloadsWeekly Downloads

    59

    Version

    1.1.2

    License

    MIT

    Last publish

    Collaborators

    • ahoran3
    • tylerdixon