Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Make it easy to include components individually #68

Open
azirbel opened this issue Jul 18, 2014 · 3 comments
Open

Make it easy to include components individually #68

azirbel opened this issue Jul 18, 2014 · 3 comments

Comments

@azirbel
Copy link
Contributor

azirbel commented Jul 18, 2014

Discussion from #19: "The files should be structured in such a way that to just use the couple of components only (not whole ember-widgets), the inclusion of the features should be very light and isolated."

Ideally, there would be a way to include just a few components, and avoid unnecessary dependencies/large amounts of code from other components.

@lstrzebinczyk
Copy link

I have created a small gem available at https://github.com/KillaPL/ember_widgets_rails to simplify rails integration. I only need carousel widget and this is the only one available in the gem right now. However, the ability to include components individually is possible to achieve using sprockets, as I've done in the gem. If you'd like, I can try sending a pull request to achieve the same effect here.

@azirbel
Copy link
Contributor Author

azirbel commented Aug 5, 2014

I'd be interested to hear more, but I don't have enough rails background to understand how your gem works or whether your approach would be applicable here. Could you explain, or just make a rough PR so I can get an idea of what it would look like?

Alternatively - @bigsley may have a better understanding, since he's worked more with rails.

blimmer added a commit to blimmer/ember-widgets that referenced this issue Aug 25, 2014
@lstrzebinczyk
Copy link

Sorry for the delay.

Basically sprockets works my adding so colled directives, and then proprocessing files. Preprocessing concatenates all requested files into one. When developing web apps it allows to work on separate files for separate concerns, and deploy a single file to production.

If you take a look at https://github.com/KillaPL/ember_widgets_rails, you will notice that all I did was, I copied whole repo from here and created file like this:

#= require ../origin/ember_widgets
#= require ../origin/src/carousel
#= require ../origin/src/templates/carousel
#= require_self

(+ some templates setting up not related to this problem)

If this file was compiled by itself, it would provide a standalone file with carousel widget. If some widgets use common files, the common is obviously only included once, so it's a good way to provide standalone, and smallest possible file with expected widgets.

It should be even possible to create an automated source generator with it, something like bootstrap has.

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

No branches or pull requests

2 participants