Tuesday, June 27, 2017

Salesforce Basics - Static Resources

Best Practices to be considered while using static resources
Here are some best practices to be considered while using Static Resources for Unilever Salesforce projects, this will be amended in the Unilever coding standards document in couple of weeks –

1.       Always use URLFOR when using a static resource and not hard coded URL’s, so that dependency checks are enforced before a static resource is removed.
2.       For 3rd Party Libraries –
a.       Check if the existing 3rd party static resource already exists.
b.      If not name it using the naming convention of : library name - version number. Use underscore for version major minor separator, e.g.:
                                                               i.      jquery-2_2_3
                                                             ii.      bootstrap-3_3_6
                                                            iii.      angular-1_5_5
c.       In the description field, add the download url, if > 255 characters, use the Bitly link shortner.
d.      Use the minified version of the resource
e.      Compress the minified version and include all associated .map files
f.        Use complete standard bundles over custom bundles, when using JQueryUI for example
3.       For Project specific JS/CSS/Framework assets –
a.       Name it with your project prefix and version number
b.      Always add a description for the asset
c.       Bundle the resources together where possible to reduce number of browser requests
d.      Compress resources together as a single static resource
4.       For Images
a.       For larger images use Documents instead of Static Resources
b.      Name it with your project prefix
c.       Always add a description for the image
d.      Use image compression to reduce browser request size and static resource requirements
e.      Compress (zip) the image(s) before storing as a static resource 

No comments:

Post a Comment

Lightning Inter-Component Communication Patterns

Lightning Inter-Component Communication Patterns If you’re comfortable with how a Lightning Component works and want to build producti...