Overview
In my last post about the Org Documentor, I detailed the first customisation option for the template content outside of the actual org detail - the title and subtitle of the header page. Something that also seemed useful to configure was the header background colour and text colour - I like the current purple/dark grey combo, but I can't imagine everyone does.
What I wasn't sure about at the time was how to go about this. The colours come from the styles.ejs file, which is included into the various templates as required. I didn't want to move away from this to have specific style stanzas in the template itself, so considered rewriting the styles file. The downside to this was it would leave me able to override the colour once, which would apply to all pages, whereas I liked the idea of being able to override at any level.
And I've used the US spelling in the title of this post, and for my property names, as otherwise it jars against the CSS names. Hate on me if you want.
Solution
<%- include ('./common/styles', {header: content.header}) %>
- This is a Salesforce CLI plug-in, and is written in Typescript. This means that if I want to add properties to an object, I have to declare them, as opposed to JavaScript where I'd just chuck them on the end.
- I want to be able to override the header colours on a per-page basis, falling back on the parent page if no override is defined, and eventually falling back on default values, which meant I needed to add this to every one of my content objects that generates the documentation pages.
interface HeaderStyle { backgroundColor: string; color: string; }
interface IndexContent { links: Array<ContentLink>; title: string; subtitle: string; header: HeaderStyle; }
"title": "Instance Overview", "subtitle": "From the metadata source", "objects": { "name": "objects", "description": "Custom Objects", "backgroundColor" : "#ff8b00", "color": "#ffffff", ... }
Updated Plug-in
Related Posts
- The plug-in on NPMJS
- Documentation generated from the sample metadata
- Sample metadata repository
- Plug-in source repository
- Org Documentor - A Little More Configuration
- Org Documentor - Fields Usage in Page Layout
- Org Documentor and AuraEnabled Classes
- Documentor Plugin - Triggers (and Bootstrap)
- Documenting from the metadata source with a Salesforce CLI Plug-in - Part 5
- Documenting from the metadata source with a Salesforce CLI Plug-in - Part 4
- Documenting from the metadata source with a Salesforce CLI Plug-In - Part 3
- Documenting from the metadata source with a Salesforce CLI Plug-In - Part 2
- Documenting from the metadata source with a Salesforce CLI Plug-In - Part 1
- Offline mobile app template plug-in Dreamforce 18 session
- Salesforce CLI Play-by-Play
- Salesforce CLI Cheat Sheet
No comments:
Post a Comment