I have been recently starting a new project outside of fcc / codepen / etc. and was wondering how I go about ‘importing’ as such my html file into the js file? I have done this recently and I do know it involves
import ...something... in the .js file, but cannot recall exactly what.
I hope this makes sense, and am hoping I can get some help on this.
For simple front-end projects, you’d usually do this the other way around (link to the
.js file from your
.html file. You do that like this:
For example, in a flat directory structure like this:
Your HTML would contain this:
import, but that’s not supported by all browsers by default yet. It’s not used for importing HTML files.
ok, so as long as I link into the html file, using the
script tag, I don’t need to import anything into the js file, unless I was to import another js file??
If you’re still confused, try googling
HTML JS CSS boilerplate hello world or similar.
Ok cool! Thankyou for your help!!