-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins LTS 2.452.1
Badge 1.10+
Groovy PostBuild plugin 228.vcdb_cf7265066
Following up from JENKINS-73167 :
Comparing hard-coded style values of Badge 1.9.1 to Badge 1.10 which introduced CSS styles (and unfortunately lost the style contents, as pursued in that referenced issue), I think it makes sense for both Badge and Groovy PostBuild plugins to extend the possible parameters of their addShortText() methods with a new option (keeping legacy code for colors/borders intact) to set a CSS style name instead-of/additionally-to those legacy values, with the Jenkins deployment free to define such style in the custom CSS file at $JENKINS_HOME/userContent/something.css linked in controller's configuration.
So instead of hard-coding color and thickness numbers in my call, I'd tell addShortText to, for example, add a style="badge-error" to the list of styles for the entry (built-in ones being fallback for un-customized values). There would be less HTML mark-up generated, and the site design would be more future-proof (or theme-proof) thanks to CSS.