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

Minified versions #33

Open
mrijken opened this issue Nov 10, 2014 · 3 comments
Open

Minified versions #33

mrijken opened this issue Nov 10, 2014 · 3 comments

Comments

@mrijken
Copy link
Contributor

mrijken commented Nov 10, 2014

Minified versions of files are not included in bower.json. Generating minified versions is left to the publisher (ie bowerstatic), if I understand it right. Do we want a feature (https://github.com/bower/bower/search?p=1&q=minified&type=Issues) for serving minified versions?

@faassen
Copy link
Owner

faassen commented Nov 11, 2014

I am not convinced this is a task for BowerStatic. This also ties into bundling.

What I'd want to look into first is what bower tooling (command-line) exists that can help do stuff like this -- perhaps a bundling tool that can take all bower dependencies, wrap them up into a large .js and then minified it. Is the idea to use Bower during development and then create a production bower package when you're ready? I'm not sure I'm really happy with that workflow either...

Once we have a better idea of what tooling exists and what workflows people recommend we could consider the possibility to integrate this into BowerStatic. So let's do the research first.

@faassen
Copy link
Owner

faassen commented Dec 18, 2014

I know grunt plugins exist that can help the JavaScript developer minify and bundle automatically. You could then ship such a thing as part of a Bower package.

The Bower metadata does, to my knowledge, not have information about "here's a minified version!". That sucks, as we'd need such metadata to do anything consistently. We're almost forced to rely on people just knowing that minified versions exist, and including them explicitly, which defeats a large part of dependency management. But that's the state of JS packaging for you...

@mrijken
Copy link
Contributor Author

mrijken commented Dec 22, 2014

When installing javascript packages via bower, you get a directory with a bower.json, That bower.json defines in 'main' the files which are needed to use the package. The files mentioned in 'main' are always the original .js files. However, a lot of maintainers of bower packages, will also distribute the minified versions. When a minified version is present, we can use that version.

When a minifed version is not present, the bowerstatic user can (has to?) minify the packages by himself (with or without grunt or similar tools) and place it next to the orginal file, so bowerstatic can use it if the bowerstatic user defines so (use_minified=True).

In my believing, we never have to minify the files in bowerstatic; the minifying is done by the maintainer of the javascript package or the bowerstatic user (web app developer).

For bundling, we can use two approaches:

  1. bundling outside bowerstatic via grunt by the bowerstatic user
  2. bundling inside bowerstatic

ad 1)
A new javascript package will be created with a corresponding bower.json in this case. When including, that bundled package will be included. We can not include one of the packages in the bundle seperately, because bowerstatic is not aware of which packages are part of the bundle.
This will work right now; no changes needed.

ad 2)
When injecting javascript resources, the injector can combine these in a bundle (ie one url which contains a list of all resources and versions). The publisher splits the url in its parts, collects the resources and returns them in one response. This option will need some work.

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

2 participants