Chris, thanks, an approach like that was exactly what I was looking for! @Jonathan: Your suggestion sounds interesting, though I'm not sure I understand everything. Why are javascript templates (we are talking about things like Mustache or Handlebar templates, right?) a special case? They are just 'normal', static files, or am I missing something? But Coffeescript would be something that requires compilation before use in the browser. Anyway, generally speaking, doing the compilation/ processing on startup sounds like a good approach.
On Jan 16, 7:01 pm, Jonathan Vanasco <[email protected]> wrote: > I've done stuff like this before - but under mod_perl, not python - I > think the same trick would work though... > > 1. The javascript "source" files were held out of the website/ > application root - just for security and safety. they're held in > something called "assets/javascript/-source" > 2. On application startup : > 1. If any pre-processing needs to be done, the items are processed > and saved into "assets/javascript/%s" % environment > 2. A symlink is created from app/appname/-envinronment to app/ > static/js > > You could even do it so for "dev" it always shows the non-minfied, but > the production/staging it always does the symlink; or never do it if a > "/javascript/environment" folder exists either. > > If you needed to treat the javascript files as templates too, this > could handle that too ( i forget who was trying to do that a few weeks > ago, i don't know why I didn't recall this method then ). > > There's a slight hit on application startup, but your templates remain > oblivious meaning writing and reading code is way easier. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
