在linemanjs中引用供应商文件夹css和js

Reference vendor folder css and js in linemanjs

本文关键字:css js 文件夹 供应商 linemanjs 引用      更新时间:2023-09-26

我正在使用linemanjs创建一个web应用程序,但是当我明确引用供应商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),但我认为你发现问题与检查元素Firebug (firefox和[也许]Chrome插件)

UPDATE: Ahhh如果你使用Jade,在you标签中添加'type='text/css',因为你最好定义文件的类型。

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

阅读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
!!!

或者在StavkoverFlow上的其他问题中发布了其他解决方案

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