debowerify icon indicating copy to clipboard operation
debowerify copied to clipboard

Debowerify with grunt-browserify

Open pawelwieladek opened this issue 11 years ago • 4 comments

How to run debowerify with grunt-browserify?

pawelwieladek avatar Jun 12 '14 10:06 pawelwieladek

gulp-browserify is blacklisted place use browserify directly with vinyl-source-stream https://gist.github.com/gdi2290/3ef9f9e6acf76f43a343

var gulp   = require('gulp');

var livereload = require('tiny-lr');
var server = livereload();

var browserify = require('browserify');
var ngannotate = require('browserify-ngannotate');
var debowerify = require('debowerify');
var uglifyify = require('uglifyify');
var watchify = require('watchify');
var source = require('vinyl-source-stream');

var config = {
  livereload: {
    port: 35729
  },
  paths: {
    scripts: [
      'app/*.js'
    ]
  },
  build: {
    path: 'public/build'
  }
};

gulp.task('browserify', function() {
  var bundler = watchify(config.paths.script);

  function gulpBundle() {
    return bundler.bundle({
        // insertGlobals: true,
        debug: true
      })
      .pipe(source(config.build.scripts))
      .pipe(gulp.dest(config.build.path))
      .pipe(reload(server)); // if you have livereload
  }

  bundler
    .transform(ngannotate)
    .transform(uglifyify)
    .transform(debowerify)
    .on('update', gulpBundle);

  return gulpBundle();
});

PatrickJS avatar Jul 20 '14 21:07 PatrickJS

@gdi2290 you are talking about gulp and the original question was about grunt.

For those who stumble upon this question, the answer is:

  1. Install debowerify npm install -SD debowerify
  2. Specify it in browserify.options.transform in the gruntfile:
browserify: {
  options: {
    transform: ["partialify", "debowerify"]
  }
 // ...
}

mr-mig avatar Oct 27 '14 13:10 mr-mig

oops, yeah you're right

PatrickJS avatar Oct 27 '14 19:10 PatrickJS

@mr-mig that works, thanks!

wesvetter avatar Dec 24 '14 20:12 wesvetter