2 Star 0 Fork 0

mirrors_ncopa/lua-joinjs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

lua-joinjs

A Lua module to join various javascript modules in a directory.

lua-joinjs concatenates various javascript module files in a directory into a single file in dependency order. Each javascript file is considered to be a separate module which can depend on others. Dependencies is specified as comments:

// depends: module

It wil also define a javascript function 'require(file)' which will return the javascript module in the file.

Example

If you for example have the following files in a directory called js:

js/foo.js js/bar.js

Where bar.js depends on foo.js.

The foo.js javascript module should be defined as:

var foo = {}
foo.hello = function() { return "hello from foo"; }
return foo

The js/bar.js looks like:

// depends: foo
var bar = {};
bar.sayhello = function() {
    var foo = require('foo');
    alert(foo.hello());
}

return bar;

To join them with lua-joinjs (with Lua code):

js = require('joinjs')
js.dir('js')
-- print the concatenated javascript to stdout
js.dump()

To use the module from main javascript code you can do:

var bar = require('bar');
bar.sayhello();

空文件

简介

Lua module to join javascript modules 展开 收起
取消

发行版

暂无发行版

贡献者

全部

语言

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_ncopa/lua-joinjs.git
git@gitee.com:mirrors_ncopa/lua-joinjs.git
mirrors_ncopa
lua-joinjs
lua-joinjs
master

搜索帮助