简体   繁体   English

如何指定本地源路径,例如total.js中node_modules中的angular

[英]how to specify local source path for example like angular in node_modules in total.js

So, I would like to have a simple chart in web page (with websockets), but it must be available offline. 所以,我想在网页(带有websockets)中有一个简单的图表,但它必须可以脱机使用。 First thing I did, I've downloaded empty project , then npm install total.js , then npm install n3-charts . 我做的第一件事,我已经下载了空项目 ,然后是npm install total.js ,然后是npm install n3-charts Now I need to specify path to local file and here I bumped into two questions: 现在我需要指定本地文件的路径,在这里我遇到了两个问题:

1) Can I have "index.html" with headers of its own, or all must be put inside "layout.html" (will they combine)? 1)我可以使用带有自己标题的“index.html”,或者所有必须放在“layout.html”中(它们会合并)吗? How would index.htm then look like? 那么index.htm会怎么样?

2) Wherever I put, path seems to not to work because (I guess) path is wrong. 2)无论我放在哪里,路径似乎都不起作用,因为(我猜)路径是错误的。 I've tried <script src="node_modules/angular/angular.min.js"> and to place that to layout.htm, but no success. 我已经尝试过<script src="node_modules/angular/angular.min.js">并将其放置到layout.htm,但没有成功。

UPDATE: there is a folder "public/js" where you can put js files, but that would imply that node_modules folder is just not to be used and that all of the files you need are to be copied to "public/js". 更新:有一个文件夹“public / js”,您可以在其中放置js文件,但这意味着不会使用node_modules文件夹,并且您需要将所有文件复制到“public / js”。 Is this the way it was intended? 这是它的意图吗?

sorry for delay. 不好意思推迟了。

  1. you can use section , documentation 你可以使用section文档
  2. of course, you have to create another node_modules directory in public folder: /app/public/node_modules/angular/angular.min.js and then it will work. 当然,你必须在public文件夹中创建另一个node_modules目录: /app/public/node_modules/angular/angular.min.js然后它将工作。

YOUR UPDATE: you can rename it as you wish 您的更新:您可以根据需要重命名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM