Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Add npm support for main repository #4739

Closed
wesleycho opened this issue Oct 26, 2015 · 11 comments
Closed

Add npm support for main repository #4739

wesleycho opened this issue Oct 26, 2015 · 11 comments

Comments

@wesleycho
Copy link
Contributor

We should publish the main repository to npm so that users can conditionally include scripts as necessary to allow inclusion by feature instead of having to include the whole library in one bulk load & potentially loading excess scripts.

We need to figure out how to do this while supporting template distribution & inclusion.

@AshCoolman
Copy link

@wesleycho could you expand on the problem of "template distribution & inclusion"?

Aside: I presume the default state should be to include all modules. This would allow the unwinding of modules to happen with time and experimentation.

Also I feel I should jump in early, and encourage any future readers to check the older issue focused on bower #2196 for motivations.

@chad-autry
Copy link

If building with Browserify, then browserify-shim + browserify-ng-html2js let you include the chosen modules given the raw source. Fairly minimal config, main thing is in figuring out the templates and javascript elements to pull in.

The developer is then responsible for minifying the javascript, but if going the Browserify route they're probablly already doing so anyways (and probably already using browserify-ng-html2js for their own html templates)

I could probably do a more in depth write up of how it works with an example that could be linked to. On the angular-ui/bootstrap side all that is needed is publishing into npm the /src and /template directories as is.

@wesleycho
Copy link
Contributor Author

@chad-autry thanks for that report - how about with Webpack?

@chad-autry
Copy link

@wesleycho I've been keeping my build system extremely minimal, just calling Browserify commands stored in my package.json npm scripts. I don't have any experience with any other packaging frameworks.

@wesleycho
Copy link
Contributor Author

Looks like there are webpack solutions out there as well.

@ctaepper
Copy link

+1

@dfsq
Copy link
Contributor

dfsq commented Nov 12, 2015

Meanwhile it's possible to specify path to tar archive in devDependencies which allows to set up custom build with just needed modules:

"angular-ui-bootstrap": "https://github.com/angular-ui/bootstrap/archive/0.14.3.tar.gz",

@ctaepper
Copy link

@dfsq thanks for the hint, works like a charm... i tried referencing the repo/commit, but that didn't get me anywhere

@joh-klein
Copy link

@dfsq how do you reference the ui-bootstrap template files in your project? Especially the ones you can't configure (i.e. modal/backdrop.html)

@dfsq
Copy link
Contributor

dfsq commented Nov 19, 2015

@joh-klein In our case we use webpack which can also import templates. It is also possible to set up build task (html2js) to pack those templates into $templateCache for only necessary modules (from BootstrapUI).

@joh-klein
Copy link

Ok, nice. How about including the non-optional templates in the corresponding js files? For npm/bower that is. Or make all template paths user configurable?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants