This project is read-only.

How to serve static content (images, css, js) from a Content Delivery Network (CDN)?

Topics: Writing modules, Writing themes
Sep 30, 2011 at 3:16 PM

I'm interested in learning how an Orchard developer can go about creating modules and skins that serve static content (images, stylesheets, and JavaScript files) from a Content Developer Network (CDN) like Amazon S3. Has anyone found a elegant way to do this? Does Orchard provide a means of handling this problem?

My foremost concern is performance. If i can offload the serving of the static content to a CDN, then there will be less burden on the application server. In addition, CDNs typically perform far better serving static content than an IIS server running Orchard will. Lastly, if there was also away to merge all js resources into one download and all CSS resources into another, that would lessen the number of files needed to be served.

Any idea, thoughts, or tips are greatly appreciated.


Matthew Pomar

Sep 30, 2011 at 6:58 PM

I'm a little loss as to what prevents you from doing exactly that. Orchard doesn't care where you point for your scripts and css.

Sep 30, 2011 at 7:54 PM

Thanks for your reply.

I guess what I was thinking was when you upload your css, js, and images Orchard could publish them to the CDN and that would be transparent to the module and/or theme. So when the module/theme linked to the asset, Orchard would have set the path to {CDN}/Styles/MyModStyles.css, {CDN}/Script/Mod.js, etc... without requiring the module administrator to deploy these assets to the CDN manually.

This could be a module of it's own, if Orchard didn't/shouldn't/won't support this as core functionality. It could also include features like those found in Teleriks MVC Web Asset Manager:

Just food for thought.

 - Matt


Sep 30, 2011 at 7:58 PM

Ah, I see. Well, that would be an interesting module, although I'm wondering if we don't already have that to an extent with the Azure support. Not sure.