-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Make Zepto available for download via Bower #949
Conversation
People who want to use Bower should use https://github.com/components/zepto which is registered as "zepto" package. See #789 (comment)
OK:
<script src="/zepto.min.js"></script> |
I hope it's clear why using a package pointing to this repo is better than relying on someone else to keep theirs up-to-date. I saw #789 already, 2 main points were that you don't want to support a package which forcefully took your package name, and you don't want to add build files to version control, right? I don't see how you get Modernizr and Normalize.css from these actions. Also, this doesn't allow you to select only modules of Zepto you want. What I had in mind was something like this: I want Zepto. Let's say I already have zepto repository cloned... $ cd ~/Code/zepto
$ MODULES="zepto event data" ./make dist
$ cp dist/zepto.js ~/Code/my-project/assets/scripts/
$ cd ~/Code/my-project <!-- ... -->
<script src="assets/scripts/zepto.js"></script>
<!-- ... --> Blast. Now I want the $ cd ~/Code/zepto
$ MODULES="zepto event data form" ./make dist # I have to remember all the modules I already had
$ cp dist/zepto.js ~/Code/my-project/assets/scripts/
$ cd ~/Code/my-project Now I want Modernizr. Naturally, I don't remember the exact URL by heart. I remember they don't have a built file in their repo so I'm going to their site to download to <!-- ... -->
<script src="assets/scripts/modernizr.js"></script>
<!-- ... --> Now I want Normalize.css. Again, I don't know the URL, looking up on GitHub... clicking on normalize.css, right click on Raw, copy URL... $ wget "https://github.com/necolas/normalize.css/raw/master/normalize.css" -P assets/styles <link rel="stylesheet" href="assets/styles/normalize.css"> And this is only for components which have a single file. Imagine what a drag would importing something like OwlCarousel be. This is process is clearly slower, that's why Bower exists. |
How often do you add or change JavaScript libraries in your project? IMO this is solving a "problem" that simply isn't one. However the real issue here is for maintainers that all these loaders and library managers require us to keep our code updated, causing extra work and adding (largely untestable) cruft to the project only to maintain a feature that saves a few users of the project 3 seconds every 2 months. |
Lately I do a lot of independent landing pages and demos, which means I start fresh many times. In these situations tools like Bower are very useful, because I don't have to leave the terminal. I might not update them very often, but I do install them often. Also, having Zepto split into source files makes it easier to see which module caused an error (although that's what source maps might do, I'm not on that train yet). Having Zepto as a Bower component allows other packages to depend on it. Let's say I make a plugin called zepto-slider, which creates a range slider and depends on Zepto: // bower.json
{
// ...
"dependencies": { "zepto": ">=1" }
// ...
} This allows me to not worry about Zepto at all, I just need to You said that the main concern is keeping the code up-to-date. Didn't you mean |
Given that's it's only one file and that we don't use bower nor want to keep files for it updated and tested, I suggest you use your own fork of Zepto and pull in any upstream changes as necessary for you. |
Shoot. |
Bower is so popular, why not add support for it? Tools like wiredep uses bower to auto add libraries inside html. To install zepto using bower, use this repo: https://github.com/components/zepto bower install zepto --save |
@brunowego this has been discussed gajillion times, you can search issues for explanations. Bower is kinda weak and retro anyway, better use a module loader like browserify. There's a link to my demo in that readme section. |
Also, there is a Zepto component for Bower, apparently. |
Thanks @silvenon 👍 |
This battle isn't over yet. You might not have
zepto
, but you havezeptojs
pointing to this repo, which is enough for now. I findwget
ing libraries very annoying, multiplied by the number of files. I know this library in particular is a bit different in the sense that you build it yourself, but it is annoying as well.You don't need to add built files to version control, you can link up source files as an array and let the users worry about compression. The choice I had to make was which files to include in
main
. I decided to include all of them (rather than the default set). Users can deal with ignoring ones they don't need, going the other way around is more tricky. wiredep is a utility which is excellent for these situations. When set up, your process of installing components could look like this:$ bower install --save zepto modernizr normalize-css $ gulp wiredep # or whatever you're using
Compare that to
wget
.Now, if I want to exclude some Zepto files, I can configure wiredep to exclude them. Then I just run
gulp wiredep
and everything is updated.(Sure, Bower is a bit clumsy, but it's getting there.)