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

how to add browserify with gulp-inject #234

Open
zymr-keshav opened this issue Dec 21, 2017 · 0 comments
Open

how to add browserify with gulp-inject #234

zymr-keshav opened this issue Dec 21, 2017 · 0 comments

Comments

@zymr-keshav
Copy link

zymr-keshav commented Dec 21, 2017

I have injected node_modules packages into my index.html. all files are adding but the content of the file has

    require('./angular');
    module.exports = angular;

now I read that browserify can do this require syntax to the original file content but did not get how and where to apply the browserify. tries with gulp-browesrify as well
there will be some way to add in transform property of gulp-inject but this does not work. here is the relevant code


var browserify = require('browserify');
var npmVendors = gulp.src(mainNPMFiles( {nodeModulesPath: '../node_modules/'} ));
  // .pipe($.babel({"presets": ["env"]}));

  var npmOptions = {
    relative: true,
    starttag: '<!-- inject:ang:{{ext}} -->',
    ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve')],
    addRootSlash: false
    // transform: function (filePath, file) {
    //       return browserify(file);
    // }
  };

  return gulp.src(path.join(conf.paths.src, '/*.html'))
    .pipe($.inject(injectScripts, injectOptions))
    .pipe($.inject(injectVendor, vendorOptions))
    .pipe($.inject(npmVendors, npmOptions))
    .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve')));
});

someone point out how to do this?

for more over this, you can find the issue on SO

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

No branches or pull requests

1 participant