[英]Unable to find bower_components in the directory above
I have the following directory structure in one of my projects: 我的一个项目中具有以下目录结构:
/web
/bower_components
/bootstrap
/jquery
/typeahead.js
/views
/index.jade
I'm trying to use these components from my index.jade
file in the following way: 我正在尝试通过以下方式使用
index.jade
文件中的这些组件:
link(src='../bower_components/bootstrap/dist/css/bootstrap.min.css', rel='stylesheet')
script(src='../bower_components/jquery/dist/jquery.min.js')
script(src='../bower_components/typeahead.js/dist/typeahead.bundle.min.js')
but it doesn't work (there's no bootstrap
-related styles on this page and jQuery code doesn't work). 但它不起作用(此页面上没有与
bootstrap
相关的样式,并且jQuery代码不起作用)。
Why? 为什么? What am I doing wrong?
我究竟做错了什么? How can I fix it?
我该如何解决?
Should I refer to these components in a different way? 我是否应该以不同的方式提及这些组件?
Should I place bower_components
directory in another folder? 我应该将
bower_components
目录放置在另一个文件夹中吗?
You probably need to change the file path to be relative to where you are compiling the jade file to. 您可能需要将文件路径更改为相对于将jade文件编译到的位置。
For example, if you render the jade like this: 例如,如果您像这样渲染翡翠:
/web
/index.html
the source paths would be 源路径将是
link(src='bower_components/bootstrap/dist/css/bootstrap.min.css', rel='stylesheet')
script(src='bower_components/jquery/dist/jquery.min.js')
script(src='bower_components/typeahead.js/dist/typeahead.bundle.min.js')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.