I spend no less than 2 hours trying to piece things together, and gave up...
(1) Where and how would I define that css variable above?
(2) Is there already code that tries to set it? How would I find that code?
Context. I am perfectly happy with the default Bootstrap theme. But I thought to explore if there was an option for small custom css adjustments. There's nothing exposed on the UI. So I started looking at the code. I was hoping that perhaps if I were to write a css file somewhere, it will get picked up. That code above looks like it will do just that - emit a style if the css variable is defined. This is where I got stuck.
I have a number of devices running OpenWRT. All on Bootstrap. The other day I default-reset the one I shouldn't have. Now I am thinking I want to change the menu header (header .fill) that would loudly scream "I am your live router.". Obviously the name doesn't do it for me. Using different themes is an option, but... I like Bootstrap.
Searching for code on github is sub-optimal. Is there some Lua IDE that provides "find-all-references", and "go-to-definition" types of functionality?
There is no such facility. The css variable must be set prior to including the header template so it is only available to custom server side template views.
Edit:
One possible solution is placing a custom preload JavaScript class which is automatically loaded by LuCI. This class can then add a link element referring to a custom CSS file.
Place the following file in /www/luci-static/resources/preload/custom_css_loader.js (filename does not matter but should not contain dashes, preload directory might need to be created first):
Once this class is loaded and working, you should see a <link rel="stylesheet" href="/luci-static/resources/custom_style.css"> element in <head> (confirm using browser debug console).
You might need to clear your browser's session storage or logout/login or close/reopen the current tab for the preload class to get picked up since the list of classes is cached in session storage to avoid enumerating them on each request.
At this point you can place a file /www/luci-static/resources/custom_style.css with arbitrary rules.
Last night I did some searching and found a couple of LuCI apps which define the css variable.
Then I tried what I didn't want to, and what @stangri mentioned:
sed "1i @import 'custom.css';\n" cascade.css.original > cascade.css
Worked just fine, with minimum change to cascade.css, and I have a separate custom.css to muck with. But it's janky...
Your solution is exactly what I was after. I tested it, and it works great. I do appreciate the time you put into this. Thank you for highlighting this preload facility - I could not find any mention of it in the documentation I read.
I'd say this code snippet is worth integrating into the main code line.