Monday, December 12, 2016

Visualforce - Beyond Basics Series 22 - Use Static Resource effectively

What can be included in Static Resource ?

Static Resource can have any items that a webpage use. These are the possible items,

  • CSS
  • Javascript
  • Image
  • Icons
  • Flash
  • Audio
  • Video


How to use them efficiently ?

I have seen some clients using them very ineffectively, by having duplicate libraries in different static resource files. Its best to avoid duplicate resources as much as possible, as the total size for all Static Resources is limited as per Salesforce Edition.

What are the advantages ?

These are the advantages,

  •    Resource are cached
  •    Easy maintainance
  •    No code update

What is the best practice ?

I have seen companies using the static resources one per feature or functionality. In long term, this is overloaded & too many features start using same resources & gets duplicated.
So, the best practice is to have ONE ZIP file each static resource. Then, it will be used across different pages. This is the best method i have practiced & advised to my clients.


No comments:

Post a Comment

Thanks for reading my blog !