maddyblue / esc

A simple file embedder for Go
http://godoc.org/github.com/mjibson/esc
MIT License
637 stars 73 forks source link

A few extra options #11

Closed slavikm closed 9 years ago

slavikm commented 9 years ago

See commit comments - added -condense, -ignore and a Dir func.

maddyblue commented 9 years ago

Could you explain more about the directory thing? I don't understand what it is doing.

slavikm commented 9 years ago

The Dir is used in scenarios where you cannot map the entire thing because of conflicts. For example, using github.com/julienschmidt/httprouter. Since I have /x mapped, I cannot map /*filepath to the entire FS so I have the following code:

r.Get("/xxx", someHandler)
r.ServeFiles("/css/*filepath", Dir(conf.IsDev(), "/css/"))
r.ServeFiles("/img/*filepath", Dir(conf.IsDev(), "/img/"))
r.ServeFiles("/js/*filepath", Dir(conf.IsDev(), "/js/"))
r.ServeFiles("/vendor/*filepath", Dir(conf.IsDev(), "/vendor/"))
r.ServeFiles("/video/*filepath", Dir(conf.IsDev(), "/video/"))

Makes sense?

maddyblue commented 9 years ago

Ok, makes sense now.

maddyblue commented 9 years ago

LGTM. Could you squish these into 1 commit and force push the branch back up? I'll merge it then.

maddyblue commented 9 years ago

I squished and merged this with you as author.