Unable to locate correct path to call js and css files


#1

I know I’m missing something obvious, but when I setup my HTML, CSS and JS files, none of the CSS and JS are working on preview. I’m pretty sure the path I’m using to call those files is incorrect. I’ve tried the complete path of /home/ubuntu/workspace/game/filename I’ve also just tried game/filename and quite a few variations in between. What am I missing to correctly call my reference files? Everything is contained in one folder, so at the moment there are no additional directories that need to be called.

Thanks!

Figured it out. Mod can feel free to Delete.


#2

Hey @megler,

Is it a vanilla static HTML project or is it a server like node or Django?

Is the project open, if so may you share the link? :hand: :link:

Meanwhile checkout this tutorial starting from this page:

:books: :snail:


#3

Hi Mike,

I’m all set. thanks. I knew it was the path and was having a brain fart getting it correct. I apologize for the premature thread.


#4

How did you solve it?


#5

Hey does anyone know how this was solved?


#6

Learning how to use relative URLs can be pretty handy, as they’re pretty powerful. To learn about how to access files from HTML, see this article. The hardest part is finding out where your files are relative to /, which I can help you with if you can tell me the type of project you have (HTML5, NodeJS, Rails, Django, etc.)


#7

Hi Danny,

It’s a rails app. The root dir seems to be going back to /students/… but not sure where that is.

Also tried putting the js file into the same directory as the view and calling it by ./c3.min.js but still no good.

As you can guess it’s c3 and d3 charts im attempting to load.

Many thanks for your help.


#8

If the workspace is public, can you give me the link so I can look through and figure out where you should place it? That would probably be easiest, as I don’t really know your file structure. :slight_smile: