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

Filename patterns #1

Closed
TrevorBurnham opened this issue Oct 3, 2011 · 6 comments
Closed

Filename patterns #1

TrevorBurnham opened this issue Oct 3, 2011 · 6 comments

Comments

@TrevorBurnham
Copy link
Collaborator

We've all been there: You update the jQuery lib in your project. Several modules depend on jQuery. But you want the file to retain its version number. So you have to do a project-wide find-and-replace from

require jquery-1.6.2

to

require jquery-1.6.3

Instead of doing that, I'd like to support wildcards, so that jquery-* scans for any file with a matching name.

@evanmoran
Copy link

This would be a very helpful to me. Is it something you are working on?

Another solution (maybe simpler?) would be to define a snocket mapping that let me link a specific keyword to a library. So for example:

snocket.name "jquery", "scripts/lib/jquery/1.6.3/jquery.min.js"

Then when I #= require jquery it will automatically find the right file.

@iangreenleaf
Copy link

@evanmoran, I'm doing the poor man's version of exactly that, using symlinks. Of course, it would still be nicer to have a built-in solution.

I can see advantages to both options. Wildcards are a little less opaque, and I like the idea of being able to do

#= require jquery-1.6.*

However, the same need could be filled with the mappings you suggest...

snocket.name "jquery-1.6", "scripts/lib/jquery/1.6.3/jquery.min.js"
snocket.name "jquery-1.7", "scripts/lib/jquery/1.7.0/jquery.min.js"
snocket.name "jquery", "jquery-1.6" # map to another mapping, yeah?

And mappings would open up some other niceties, such as

snocket.name "dom_query", "vendor/jquery_or_some_other_library_i_may_change_at_will"

@evanmoran
Copy link

Nice @iangreenleaf, symlinks are a great suggestion. thanks!

I like your idea of mapping to other mappings. What do you think of the word alias instead of name?

snocket.alias "jquery-1.6", "scripts/lib/jquery/1.6.3/jquery.min.js"
snocket.alias "jquery-1.7", "scripts/lib/jquery/1.7.0/jquery.min.js"
snocket.alias "jquery", "jquery-1.6" # map to another mapping, yeah?

Lastly I see this as useful for directory includes as well. For example:

snocket.alias 'jqueryplugins', 'jquery/1.4.5/plugins'     # include a bunch of stuff compatible with this version of jquery 

@iangreenleaf
Copy link

Yeah, I like alias a lot better.

@pthrasher
Copy link
Owner

Fixed in 2.0.0 #43

@pthrasher pthrasher mentioned this issue May 16, 2013
23 tasks
@ghost
Copy link

ghost commented Jun 27, 2014

It would be really useful to have directory aliases as well.
Something like:
#= require @application/core/Observable
An example implementation is here

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

No branches or pull requests

4 participants