gpt4 book ai didi

javascript - 在 linemanjs 中引用 vendor 文件夹 css 和 js

转载 作者:行者123 更新时间:2023-11-28 12:47:13 30 4
gpt4 key购买 nike

我正在使用 linemanjs 创建网络应用程序,但是当我明确引用 vendor cssjs 文件时,它不会引用该位置。让我知道我在 linemanjs 上做错了什么。

我在文件中尝试的简单操作是 -

link(rel="stylesheet",href="/vendor/css/myvendor.css")

link(rel="stylesheet",href="/css/myvendor.css")

link(rel="stylesheet",href="css/myvendor.css")

-> myvendor.css 肯定位于 vendor 下的 css 文件夹中。

最佳答案

因为不使用基本 HTML 的基本标签:

<link rel="stylesheet" type="text/css" href="css/myvendor.css">

必须包含服务器或客户端的路径。

如果文件夹 vendor 包含所有文件 html 和包含您用于站点的文件的文件夹,则我之前在标记中包含的路径是正确的。

如果仍然不包含此文件 css ,问题是文件不存在或声明错误的文件名或结构 css 错误(最好发布文件 css)但我认为你找到了Inspect ElementFirebug(firefox 和[也许] Chrome 的附加组件)的问题

更新:啊哈,如果你使用 Jade,请在你的标签内添加 'type='text/css' 因为你最好定义文件类型。

link(rel='stylesheet', href='css/myvendor.css', type='text/css' )

阅读documentation of JADE继续

Template inheritance

If you have multiple views with a similar structure, you will end up with the same set of includes in all your views. This approach can quickly become complicated and untidy, if the number of views and includes increases.

使用 Jade,您可以生成包含文件 css 的标签:

!!! 5
html
head
title Learning Inheritance
link(rel='stylesheet', href='/css/myvendor.css')
body
!!!

或者在其他question on StavkoverFlow中发布了其他解决方案

head
title test include
| <style type='text/css'>
include css/myvendor.css
| </style>

关于javascript - 在 linemanjs 中引用 vendor 文件夹 css 和 js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24821344/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com