0

for example I have a public folder that stores all the css files, and a view folder that stores the ejs files. So when I link the css file in the ejs file, I do

<link rel=”stylesheet” href=”styles.css”>

or

<link rel=”stylesheet” href=”/styles.css”>

I don't understand how it gets the css file without me redirecting it, whereas in react I need to do e.g.

import "../public/styles.css"

which makes sense to me as I am starting from the current directory.

Eric
  • 77
  • 9

1 Answers1

0

link- is a common JS syntax, and is added to the head of the HTML, optional for older browsers that doesnt recognize import.

import- es6 syntax

there is no much of difference between them, only in mechanism

Orbb92
  • 61
  • 4
  • I know that, but why they use different directory paths? – Eric Sep 02 '20 at 08:11
  • https://stackoverflow.com/questions/1022695/difference-between-import-and-link-in-css#:~:text=8%20Answers&text=In%20theory%2C%20the%20only%20difference,advantage%20in%20terms%20of%20performance. read it, it might help – Orbb92 Sep 02 '20 at 08:14