admin管理员组文章数量:1315262
I am trying to not rely on the basic code as follows in my file:
<script src="//d3js/d3.v3.min.js"></script>
I am trying to include the d3 library in my file structure. I have created a "libs" file in my project. Here is the link to the page to download the d3 library: My question is after downloading the necessary files from github, do I simply create a d3 folder in my libs folder and place the files there? If so, do I reference a specific file or just the folder?
I am trying to not rely on the basic code as follows in my file:
<script src="//d3js/d3.v3.min.js"></script>
I am trying to include the d3 library in my file structure. I have created a "libs" file in my project. Here is the link to the page to download the d3 library: https://github./d3/d3 My question is after downloading the necessary files from github, do I simply create a d3 folder in my libs folder and place the files there? If so, do I reference a specific file or just the folder?
Share Improve this question asked Jul 28, 2016 at 14:05 Martin GreenMartin Green 371 gold badge2 silver badges6 bronze badges2 Answers
Reset to default 2There are a few different ways of importing other people's code. You could, as you suggested, just download the latest release and copy the d3.js
or d3.min.js
into a lib/
directory, then import it like so:
<script src="lib/d3.min.js"></script>
Alternatively, if you're using a package manager like npm
or bower
, you could just install it using that, as remended in the README. There's also a resource showing how you could use a bundler like Rollup to package D3 with all of your other libraries.
You must include your local copy of D3 like so:
<script src="libs/d3.v3.min.js"></script>
No need to create a separate folder if you'll use just D3. If you need other dependencies use like this:
<script src="libs/d3/d3.min.js" charset="utf-8"></script>
<script src="libs/d3/topojson.v1.min.js"></script>
<script src="libs/d3/d3-queue.v2.min.js"></script>
本文标签: javascriptHow do I import the D3 library into my project file structureStack Overflow
版权声明:本文标题:javascript - How do I import the D3 library into my project file structure? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741952551a2406794.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论