I've experimenting with the Customer Portal and figured out how to inject CSS and JS via custom code in the header. Unfortunately, on every page load there's a flicker as Salesforce first loads the default formatting and only then loads and applies my changes. (The flicker is less noticeable after the first few page loads, but still there.) Is there a good way to eliminate this flicker or to get my custom CSS to apply earlier?
FYI, I want to choose stylesheets dynamically based on which page I'm on, so rather than including
Two possible solutions. In your header file:
1) first load ALL stylesheets in your html, instead of dynamically, eg:
then use the body class in your CSS to differentiate the pages, eg:
which should limit the FOUC (Flash Of Unstyled Content) to the first page load only.
OR 2) you can combine all your styles into one string and include it in a style tag:
so that rendering will be blocked until all your styles are loaded, at the expense of making all pages heavier and probably incorporating a build step.