Visualforce & Dynamic CSS

When I started working on the Force.com platform CSS was an area that made me sad a bit. Deep down. Overriding the Salesforce CSS is a nightmare and I would recommend you don’t begin the dark and daunting journey down that path. Rather start afresh, you’ll thank me later.

That said, dealing with CSS on the platform can still be a timeconsuming task. Especially if you are incorporting images into your pages using CSS. My initial process was something similar to this:

  1. Create a stylesheet and some styles. Hopefully you’ve done a good job because you have no way of quick-previewing the result.
  2. Include said stylesheet and all referenced images in a zip file. Take care to preserve the directory structure so that you can reference all stylesheet and image files correctly.
  3. Upload the zip file as a static resource.
  4. Create references to the stylesheet in appropriate pages.
  5. View page. Realise you need to move one of your outputPanels 3px right. Be sad. Deep down. Goto 1.

Read more

VisualForce Tag Cloud Component

Tag clouds are nothing new on the interwebs, but there is some debate as to which sort of implementation is best. In this debate I prefer the simplest solution [insert further debate as to the definition of ‘simplest’ here] which I propose to be a simple unordered HTML list with some CSS styling.

Furthermore, wouldn’t it be great if this solution were dynamic, thus enabling you to create tag clouds specific to a particular application context?. Rhetorical question, of course it would be. To this end I’ve created a component that utilises a controller, mostly dynamic in nature.

To start with, let’s have a look at the component code

Read more