[英]Is there a way to link an external library from outside the project directory?
I have a jquery library in my project but need to put it in linux /usr/share/js directory and not inside of my project directory. 我的项目中有一个jquery库,但需要将它放在linux / usr / share / js目录中,而不是放在我的项目目录中。
Is there a way to do a linking in the index.html? 有没有办法在index.html中进行链接?
Including in the index.html: 在index.html中包括:
<script src="/usr/share/js/jquery.min.js"></script>
doesn't help, as it looks into my working dir and I don't have a 'usr' dir 没有帮助,因为它查看了我的工作目录,而我没有“ usr”目录
/usr/share is in the root directory and not in my working one. / usr / share在根目录中,而不在我的工作目录中。 I don't use any php or the stuff, is there a simple way to solve this?
我不使用任何PHP或其他东西,有没有简单的方法可以解决此问题?
You need to back out of the file you are currently in by using the ../
command which goes back one directory. 您需要使用
../
命令返回当前目录,该命令返回一个目录。 Depending on how many files deep the index.html
file is in your project, you may need more then one like so: 根据项目中
index.html
文件的深度,可能需要多个文件,如下所示:
<script src="../../../../usr/share/js/jquery.min.js"></script>
This will direct you 4 files out of where your index.html
file is located, you may need more or less depending just do some searching through your directories and adjust accordingly. 这会将4个文件引出
index.html
文件所在的位置,您可能需要或多或少地依赖于只是在目录中进行一些搜索并相应地进行调整。
You can create symlinks for files like this, to allow access to serve from not your document root. 您可以为此类文件创建符号链接,以允许从您的文档根目录而不是文件根目录进行访问。 The web server is also needs to be configured to follow symlinks when serving.
服务时还需要将Web服务器配置为遵循符号链接。
More info for Apache: http://httpd.apache.org/docs/2.4/urlmapping.html 有关Apache的更多信息: http : //httpd.apache.org/docs/2.4/urlmapping.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.