Skip to main content

Speed up Saleforce Development

Fast Salesforce `staticresrouces` Development Locally

The problem with front end development in the cloud is that it is painfully slow! Unfortunately this is the reality of the cloud nature of SF and it will remain so - at least until there will be ability to spin up local SF development servers.

It takes about 30 seconds or more to save on a busy org. That is mainly because of the typical save cycle, 'change', 'zip', 'save to server', and then 'refresh in browser':

  • doing this many times a day adds up to a substantial time lost
  • loss of focus/concentration - while you wait
  • ‘clobbering of static resources’ when working in a team
  • pure maddening in tight timelines

Current Solutions

Make changes in browser, ex. Chrome
  • Great for CSS
  • Limited for JS (can’t re-run `onload` event)
  • Cumbersome for HTML
  • Can’t use your favorite (Eclipse IDE) editor
Develop files locally
  • Ok for initial design mockups
  • Impractical once code starts living in SF
  • Javascript / CSS injection
  • Browser security issues as file must live on server
  • Ok for CSS, problematic for JS
  • Order issues, `onload` event, etc.
  • Can’t do HTML

  • The Solution: Have Charles or Fiddler serve it!

    The idea is to use an intermediate proxy to highjack our requests and inject files from a local file system. There are two mainstream popular programs to accomplish this. An old and tried Fiddler for Windows machines and Charles Mac

    Once you setup Charles or Fiddler you can map any server response to local files. In the case of CSS/JS this allows you to edit these locally and immediately be able to preview your changes in the browser. Since the common design pattern is to use folder for static resources you can just map the entire `resource-bundles` folder instead of individual files:

    • In Charels the 'Path' matching pattern should be of format `/resource//*` mapped to local path to the bundle in `resource-bundles` folder (a Maven's Mate convention that Eclipsers should follow).
    • For Fiddler the 'AutoResponder' rule should be `REGEX:.+?//.visual.force.com/resource/.+?//(.+)$` mapped to `\resource-bundles\\$2`.

    If you found this useful please feel free to comment or follow me .

    Comments

    Popular posts from this blog

    Storing passwords in PuTTY

    How to save SSH username/password for auto login in PuTTy The answer is you can't do it...at least in plain PuTTy. However there is an awesome fork with that let's you store the username and password and other additional features called KiTTy . So grab yourself a copy and +1 this if you do, thanks.

    Softeher 'Error occurred. (Error code: 2)' sollution

    Protocol error occurred. Error was returned from the destination server. The Softether server by default to run on port 443 , if you server also hosts normal https then 443 is already taken and so Softether can't bind to it. When you run `vpncmd` it attempts to connect, find an active port, but of course fails with 'Protocol error occurred. Error was returned from the destination server.' because it's not actually connecting to the vpn server. By default Softether also listens on 992 , 1194 , and 5555 so the sollution is to modify specify `localhost:5555` when executing the `vpncmnd`. If this has helped you feel free to comment or follow me on twitter @danielsokolows .

    LightScribe Template Labeler for Windows 10

    LightScribe Template Labeler installation "Operating System Inadequate" Issue Unfortunately 'LightScribe Template Labeler' installation will not work on Windows 8 and Windows 10 machines as the install simply will error out with 'Operating System Inadequate'. Trying to install using compatibility mode did not help. Installing LightScribe Template Labeler Workaround However if you simply copy the installed folder from an older machine like Windows 7 into your `C:\\Program Files (x86)\LightScribe Template Labeler`, create a shortcut, then the software will still happily work, see: http://answers.microsoft.com/en-us/windows/forum/windows8_1-performance/lightscribe-templatesimple-labeler-the-system-is/c2ebee28-bfb5-4aef-beb3-a43329561da8?db=5&auth=1 So you can install Windows 7 machine in a virtual machine, install 'LightScribe Template Labeler', and then copy the resulting folder to your Windows 8 or Windows 10 machine. For my own convenien...