What is the correct path to the static interface .js file templates inside the "public" folder (using Express / NodeJS and EJS)?

Is there a way to “template” static front-end.js files (those that are inside the “public” folder) in the same way that I template my HTML using EJS?

Is it possible? If so, what is the best way to do this?

+4
source share
1 answer

js, css - , js , Cache-Control, -, cloudflare, Cache-Control .

.

EJS:

<input type="hidden" name="language" id="language" value="<%-language%>">

JS:

var language = document.getElementById('language').value; console.log(language)

  1. script ejs, .js .

EJS:

<script> var language = <%-language%></script>

JS:

console.log(language)

+6

Source: https://habr.com/ru/post/1682540/


All Articles