【发布时间】:2018-06-27 05:01:57
【问题描述】:
我正在使用 html、css 和 js 创建一个网页,我没有遵循任何框架,所以我只有页面(这是要求)。所以我的页面中有很多 javascript,我想将我的 javascript 移动到另一个脚本文件。所以我有两个问题: 1)最好的方法是什么? 2) 有什么方法可以像使用 node_modules 一样将我的函数调用为属性。
var printMsg = require('printModule');
printMsg.print();
或在 jquery ($.whatever()) 中
【问题讨论】:
-
你可以看看 Webpack,它允许强大的代码组织:medium.com/the-node-js-collection/…
标签: javascript jquery javascript-objects