rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 97 forks source link

Defered javascripts for production environment #119

Closed gabrielengel closed 11 years ago

gabrielengel commented 11 years ago

We can optimize pageloading by defering javascripts.

I'm not sure on how to implement this on sinatra-assetpack nor how to test it.

If you belive it's a valid feature, could you give me some feedback on this current code? I'll send you another pull request afterwards.

Thanks!

j15e commented 11 years ago

I think we might create an helper method to do this more easily but we should not defer javascript by default neither as an option as I think this is out of the scope of a basic asset manager.

We should offer alternate methods to <%= js :app %> ex. <%= js_path :app %> which would return only the URL and not a complete tag which allow you to use a defer script like would like to.

gabrielengel commented 11 years ago

Surely! A helper as js_path can be flexible enough for different implementations of deffering. Sounds nice!

But how do you think this should bahave under development environment, where we don't/shouldn't have a packaged js?

j15e commented 11 years ago

Good question, it might always return an array of path(s)?