aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

Minifying Views does not work #51

Closed niieani closed 8 years ago

niieani commented 8 years ago

View-Templates are not minified during bundling, even though minify is set to true.

ahmedshuhel commented 8 years ago

@EisenbergEffect We are using text plugin for bundling views as our loader expect. And, unfortunately it does not support minification (the plugin will never support that as it has no idea about the actual content). We, on the other hand, know the content type(html/css). Given that bundle the configurations looks like:

includes: [
  ''**/**/*.html!text"
  ''**/**/*.cssl!text"
]

We may pre-expand the globs with specific file extensions .html/.css and process them (minify) and then hand over to systemjs-bundler one by one.

Thoughts?

EisenbergEffect commented 8 years ago

@ahmedshuhel Absolutely. If we can build html and css minification into the bundling process, that would be great.

As a more general idea, perhaps the bundler should have certain types of plugins that it can apply, based on file extension or something like that. I'm thinking of an extensibility point. This is something we could hook our view pre-compile into, but also someone else may want to hook a sass or less compiler into...or any other type of transformation.

After you finish your current round of improvements on the bundler, I'd like you to consider if there is a general design improvement we could make that would enable all these scenarios.

gheoan commented 8 years ago

@EisenbergEffect SystemJS plugins could do that

EisenbergEffect commented 8 years ago

I suppose it could be done with a systemjs plugin. However, wouldn't that affect the module id? We don't want to create a discrepancy between the module id that is encoded into the bundler and the one that is used at runtime. We also don't want different module ids for bundled vs. unbundled apps. That would be my only concern. @ahmedshuhel knows more about how the builder process works though, so maybe it's not an issue and we can just use them...or if not, maybe we can use the same api, but run them ourselves so they don't affect the module ids.

ahmedshuhel commented 8 years ago

I would like to let everybody know that we are working on it. Already made some great progress. Hope to get it in in the next version.