[英]What is best practice for font-end NPM package file structure?
I am making an NPM package for the front-end and I want to know what the best file structure to use is. 我正在为前端制作一个NPM软件包,我想知道要使用的最佳文件结构是什么。 I have one
code.js
file and will have one code.min.js
file. 我有一个
code.js
文件,并且将有一个code.min.js
文件。 Should I have these two files in the root directory? 我应该在根目录中有这两个文件吗? In a
dist
folder? 在
dist
文件夹中? In a src
folder? 在
src
文件夹中? What is the best practice for this file structure - specifically on the front-end? 此文件结构的最佳实践是什么-特别是在前端?
you should separate your source from your development compiled files, as much as possible. 您应尽可能将源代码与开发编译文件分开。
For example on my projects, all minificated files, should be in a dist folder. 例如,在我的项目中,所有缩小的文件都应位于dist文件夹中。 The non minificated files, are not getting on the server.
未缩小的文件不在服务器上。 You wouldn't want a customer to accidentally use a non-min css and get 0.2 sec for extra load, would you?
您不希望客户意外使用非最小CSS并获得0.2秒的额外负载,对吗? :)
:)
Also, I do strongly recommend you to google this: "recommended structure [add framework name here]" 另外,我强烈建议您在Google上搜索:“推荐的结构[在此处添加框架名称]”
code.min.js
is certainly the minified version of code.js
. code.min.js
肯定是缩小的版本code.js
。 You simply need to add code.min.js
to your project. 您只需
code.min.js
您的项目添加code.min.js
For node projects, you can insert directly the cdn link into your code or when you create a file ( js, css or image), it goes to the public folder. 对于节点项目,您可以将cdn链接直接插入代码中,或者在创建文件(js,css或图像)时将其转到公用文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.