Where to Put CSS and JS files to be included in HTML Pages

997 views
Skip to first unread message

JethroNull

unread,
May 12, 2015, 3:26:19 PM5/12/15
to node...@googlegroups.com
I'm building an HTML page to be served by Node-Red and which uses websockets.  I really need to separate some of the CSS and JS files.  Which directory should be used to store those and how to reference them in the HTML?

Nicholas O'Leary

unread,
May 12, 2015, 3:37:06 PM5/12/15
to node...@googlegroups.com

Quick answer as I'm away from my laptop at the moment... have a look at the httpStatic property in settings.js.

Nick


On Tue, 12 May 2015 20:26 JethroNull <jon.ri...@gmail.com> wrote:
I'm building an HTML page to be served by Node-Red and which uses websockets.  I really need to separate some of the CSS and JS files.  Which directory should be used to store those and how to reference them in the HTML?

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jon Richings

unread,
May 12, 2015, 4:13:10 PM5/12/15
to node...@googlegroups.com
Nick,

"httpStatic: '/home/nol/node-red-dashboard/'" 

Presumably this directory has to be created (or another suitable one) and the httpStatic property uncommented in settings.js?

--
http://nodered.org
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/-ndMIKS2vV0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.

Nicholas O'Leary

unread,
May 12, 2015, 4:18:31 PM5/12/15
to Node-RED Mailing LIst
Hi Jon,

yes, it should point at a directory containing the content you want to be served by node-red, and it has to be uncommented to have any effect.

Nick



Julian Knight

unread,
May 12, 2015, 4:38:02 PM5/12/15
to node...@googlegroups.com
And it is a static folder that feeds into Express so you can put sub-folders in to keep things organised. In you HTML, you simply reference as src="somefile.js", src="js/myfile.js" or whatever. I have folders for my js and css as you would do with any other project.

JethroNull

unread,
May 12, 2015, 6:08:11 PM5/12/15
to node...@googlegroups.com
Thanks guys, works for me.  But just incase another noob is reading this one day, you also need to reboot for the settings.js changes to take effect.
Reply all
Reply to author
Forward
0 new messages