I am trying to set up Cloudfront in my nodeJS Express app (using Jade as a rendering engine) with the following requirements:
- Only use Cloudfront on production server (not on localhost or staging server)
- Not using a conditional statement on all scripts and css in the jade templates
- Trying to find a one or two liner in case I need to switch to a different provider
I came up with one possible solution: overriding how Jade renders links and scripts and adding the Cloudfront url only on production:
Jade.override(“link”,function(){
if(prod) link.src = cloudfront_url + link.src
})
However, Jade doesn't allow overriding any its functions. Does anybody know an easy way to use Cloudfront on a node app?
Aucun commentaire:
Enregistrer un commentaire