Closed franciscolourenco closed 8 years ago
Yep! The only thing that globify does is expand glob patterns. All other parameters get passed straight to Browserify or Watchify. So you can specify any plugins, transforms, or options you want, including uglifyify.
globify "lib/**/*-entry-file.js" -t uglifyify --debug
btw... you might also want to check out simplifyify, which is another one of my projects. It simplifies the Browserify CLI for most common use-cases, such as code-minification, source maps, and code-coverage instrumentation.
I meant minifyify because some commands require the name of the files to be passed. Do you recommend one over the other?
Ah I remember simplify now, I opened https://github.com/BigstickCarpet/simplifyify/issues/6 a while back.
Yeah, minifyify is tricky, because it needs you to pass the name of a single file as an argument, which makes it not work well with glob patterns at all. I wonder if minifyify has an option to auto-generate the sourcemap file name? If so, then that would probably work for you
When using
globify 'dist/js/*.coffee' -t uglifyify --outfile 'dist/js/*.js'
I get this error:
Error
at new JS_Parse_Error (<anonymous>:1526:18)
at js_error (<anonymous>:1534:11)
at croak (<anonymous>:2026:9)
at token_error (<anonymous>:2034:9)
at unexpected (<anonymous>:2040:9)
at semicolon (<anonymous>:2060:56)
at simple_statement (<anonymous>:2240:73)
at eval (<anonymous>:2113:19)
at eval (<anonymous>:2073:24)
at eval (<anonymous>:2827:23)
at Object.parse (<anonymous>:2837:7)
at /Users/user/Work/extension/chrome-extension/node_modules/uglifyify/node_modules/uglify-js/tools/node.js:64:33
at Array.forEach (native)
at Object.exports.minify (/Users/user/Work/extension/chrome-extension/node_modules/uglifyify/node_modules/uglify-js/tools/node.js:59:15)
at Stream.ready (/Users/user/Work/extension/chrome-extension/node_modules/uglifyify/index.js:70:19)
at Stream.<anonymous> (/Users/user/Work/extension/chrome-extension/node_modules/uglifyify/index.js:96:12)
at _end (/Users/user/Work/extension/chrome-extension/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/user/Work/extension/chrome-extension/node_modules/through/index.js:74:5)
at DestroyableTransform.onend (/Users/user/Work/extension/chrome-extension/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:545:10)
at DestroyableTransform.g (events.js:260:16)
at emitNone (events.js:72:20)
at DestroyableTransform.emit (events.js:166:7)
at endReadableNT (/Users/user/Work/extension/chrome-extension/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:960:12)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickCallback (node.js:388:17)
Don't forget to add the coffeescript transform
Its in the global transforms.
kk. well try using the raw Browserify command first, to make sure everything's correct. then replace browserify with globify. the error you're getting is from uglifyify, not globify
Thanks, it was something with the global transforms, because I'm importing some coffee files as modules.
Now somthing else. From the Ugligyfyify docs:
"Uglifyify provides an additional optimization when used with Uglify, but does not provide all of the optimization that using Uglify on its own does, so it's not a replacement."
And indeed the bundle size resulting from uglifyify is bigger than the one produced by normal Uglifyjs2. Is it possible to apply normal uglify with globify?
Is there a way to use globify together with uglifyify?