动态生成的(带哈希)文件夹中的相对路径

Relative path in dynamically generated (with hash) folder

提问人:Pedro Fernandes 提问时间:2/9/2023 更新时间:2/9/2023 访问量:50

问:

使用 Express,我尝试在 HTML 文件中访问相对路径(css/...、assets/...)。

我不能使用 express.static(),因为 HTML 文件位于动态生成的文件夹中,其名称为哈希值。

有许多文件夹里面有一组不同的文件,这些文件夹位于“public/assets/template/file/tmp”中。

enter image description here

服务器正在尝试根据 express.static 中定义的内容(即“path.join(__dirname,'public')”访问这些文件,以便处理项目中的其他文件。

公用文件夹(位于项目根目录中)如下所示:

enter image description here

index.html 头:

enter image description here

在当前情况下,我想不出什么可做的,也许在访问动态生成的文件夹中的文件时设置不同的 express.static,但这看起来不是最好的方法(甚至不确定是否可能)。

HTML 节点.js 表示 静态 文件位置

评论


答: 暂无答案