tags:

views:

130

answers:

1

Hi I am new to Dojo and tried to compress the Dojo Script by creating a custom build. As we know that it will be good to set expiry so that file should not get downloaded at every time but that is my problem as since compression and custom build there is no EXPIRE TIME for Dojo.js.

How can we set Expire for the compiled custom build.

A: 

I don't really get your question.

People usually create custom dojo builds because they want to include only the packages they need. By creating your build, you're not working on caching issues, nor minifying code - it's about downloading and interpreting less code (you can use the great "Xdomain loading" feature, but that's another question).

I think you want to tweak your httpd.conf file (if you're using apache server) and set an Expire Header with the following:

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType application/x-javascript A8640000
</IfModule>

(Here, you'll be setting the Expire date to "client Access date + 100 days" for all javascript files)

Some additional advices:

  • do not forget to add the "FileETag none" line to your configuration, especially if your files are hosted on multiple servers.
  • do not forget to change URLs when a new version of your app is out. Adding a version number or a delivery date in URLs is a good idea. Otherwise your agressive caching directives will be a problem.
Brian Clozel