jam icon indicating copy to clipboard operation
jam copied to clipboard

A way to specify a minified build to use during `compile`.

Open jdalton opened this issue 13 years ago • 9 comments

I maintain Lo-Dash which has its own minified build that removes debug features and performs other tweaks to make a smaller minified file. Is there a way to specify a minified file in package.json to use for compile?

jdalton avatar Aug 12 '12 01:08 jdalton

Lo-Dash also has its own build process for custom builds. If I could tie that in as well that would rock.

jdalton avatar Aug 12 '12 01:08 jdalton

There is currently no way to do this, all minification is automatically handled by the requirejs optimizer. I can see that in some rare cases such as lo-dash it would be useful for you to also specify a pre-minified file.

I'm happy to support this but I need to give some thought as to how it will work in practice, and make sure it plays nicely with the Jam compile command.

On Sat, Aug 11, 2012 at 06:00:48PM -0700, John-David Dalton wrote:

I maintain Lo-Dash which has its own minified build that removes debug features and performs other tweaks to make a smaller minified file. Is there a way to specify a minified file in package.json to use for compile?


Reply to this email directly or view it on GitHub: https://github.com/caolan/jam/issues/57

caolan avatar Aug 12 '12 05:08 caolan

@caolan Cool. Is a workaround for this adding to the package.json

  "jam": {
    "main": "lodash.min.js"
  }

for now?

jdalton avatar Aug 12 '12 05:08 jdalton

That would mean users of the package would always be loading the minified build, which is probably ok. It might be worth checking what happens when it goes through "jam compile" and the requirejs optimizer runs uglify on it... I assume that will be fine.

On Sat, Aug 11, 2012 at 10:12:32PM -0700, John-David Dalton wrote:

@caolan Cool. Is a workaround for this adding to the package.json

  "jam": {
    "main": "lodash.min.js"
  }

?


Reply to this email directly or view it on GitHub: https://github.com/caolan/jam/issues/57#issuecomment-7672906

caolan avatar Aug 12 '12 07:08 caolan

@caolan Ok thanks!

Yap, it's not perfect as the debug helpers for _.template and console.log(_.each) are nice but since using the dev build in production code is worse, the minified will do until the option is added to Jam.

jdalton avatar Aug 12 '12 07:08 jdalton

I've been using Lo-Dash recently btw and quite enjoying it. I use _.partial a lot, always seemed strange it wasn't included in underscore.

Keep up the good work :)

On Sun, Aug 12, 2012 at 12:17:15AM -0700, John-David Dalton wrote:

@caolan Ok thanks!

Yap, it's not perfect as the debug helpers for _.template and console.log(_.each) is nice but since using the dev build in production code is worse, the minified will do until the option is added to Jam.


Reply to this email directly or view it on GitHub: https://github.com/caolan/jam/issues/57#issuecomment-7673439

caolan avatar Aug 12 '12 07:08 caolan

@caolan Awesome!! Lo-Dash v0.5.0 will be bumped to stable (previously RC) in a day or so. I noticed that Jam has a dependency on Underscore.js, it would be rad if it was swapped out with Lo-Dash :D

jdalton avatar Aug 12 '12 07:08 jdalton

All in good time :P -- more important than that is a way for people to easily swap underscore for lodash when using jam packages that depend on the former, I think. See some of my ideas for this on a recent jam mailing-list thread: https://groups.google.com/d/msg/jamjs/LJ2uGL63ens/M6-ygB5j614J

We might even get to a point where "jam install backbone" asks you whether you'd like to use underscore or lodash as the 'underscore' dependency.

caolan avatar Aug 12 '12 07:08 caolan

And I've dragged this issue way off-topic :)

caolan avatar Aug 12 '12 07:08 caolan