[英]How can I include all js files like we add all css files in one main.css
We can use all css files as one file for example main.css: 我们可以将所有css文件用作一个文件,例如main.css:
@import url(bootstrap.css);
@import url(bootstrap.min.css);
@import url(bootstrap-theme.css);
@import url(bootstrap-theme.min.css);
@import url(style.css);
@import url(w3.css);
How can we include and use all js files as one main.js and use all javascript files for example 我们如何包含和使用所有js文件作为一个main.js并使用所有javascript文件作为示例
main.js main.js
<script src="http://127.0.0.1:7070/js/aa.js">
<script src="http://127.0.0.1:7070/js/bb.js">
<script src="http://127.0.0.1:7070/js/cc.js">
<script src="http://127.0.0.1:7070/js/dd.js">
<script src="http://127.0.0.1:7070/js/ee.js">
You can't natively include JS files like the import statement in CSS (though it's important to note that the CSS import still downloads multiple files, it's just a convenience for organizing the rules. ) 您不能像CSS中的import语句一样在本地包含JS文件(尽管需要注意的是CSS导入仍会下载多个文件,但这只是组织规则的一种方便。)
Have a look at tools like Webpack, require.js, Grunt, and Gulp. 看一下Webpack,require.js,Grunt和Gulp之类的工具。 All of which do concatenation and minification for you as build steps.
所有这些都在构建步骤中为您进行串联和最小化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.