What's the best way to dynamically insert CSS files into my TMS WEB Core website using Delphi?
I want to load a certain CSS file depending on the theme (dark/light). So whenever the website opens, then it needs to dynamically load the correct CSS file.
How can this be achieved?
The
TApplicationclass has anInsertCSSandRemoveCSSfunction that can be used for this.So as an example, let's say I want to dynamically load Bootstrap into my application with a button click, I could do this:
You could also do this directly in the
.dprfile such as:Running the above examples would insert the following line of code into the
<head>tag on your page: