One CSS for multiple Dashboard instances

Hi,

We're running multiple NodeRED instances (under FlowFuse), each running its own Dashboard 2 configuration.
Would it be possible to have one central ui-template node where all other Dashboard 2 sites get their CSS main from?

Thanks!

To achieve this, you can follow these steps:

  1. Host CSS centrally: Host your main CSS file in a location accessible to all Node-RED instances. This could be a web server or a shared network location.
  2. Modify ui-template nodes: In each Dashboard 2 configuration's ui-template node, reference the centrally hosted CSS file using a <link> tag in the <head> section of the template.

For example, your ui-template node template might look like this:

html

<head>
    <link rel="stylesheet" type="text/css" href="http://central-location.com/main.css">
</head>

Replace "http://central-location.com/main.css" with the actual URL where your CSS file is hosted.

  1. Ensure accessibility: Make sure that the Node-RED instances have network access to the location hosting the CSS file. Adjust firewall settings if necessary.

Or;

  1. Set the CSS content using global.set:
global.set('cssContent', '/* Your CSS content here */');
  1. In your ui-template node, use <style> tags to include the CSS content:

html

Copy code

<head>
    <style>
        {{global.get('cssContent')}}
    </style>
</head>

Ah yes.. of course! Solution 2 is perfect for me.
My train of thought about this was all wrong. Simple is best.

Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.