Heyter / gluamin

A Lua minifier written in JavaScript

Home Page:https://mths.be/luamin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gluamin, a Lua minifier written in JavaScript

luamin uses the excellent gluaparse library to parse Lua code into an Abstract Syntax Tree. Based on that AST, luamin then generates a (hopefully) more compact yet semantically equivalent Lua program. Here’s an online demo.

luamin was inspired by the LuaMinify and Esmangle projects.

Feel free to fork if you see possible improvements!

Usage

var luaCode = 'a = ((1 + 2) - 3) * (4 / (5 ^ 6)) -- foo';
luamin.minify(luaCode); // 'a=(1+2-3)*4/5^6'

// `minify` also accepts luaparse-compatible ASTs as its argument:
var ast = gluaparse.parse(luaCode, { 'scope': true });
luamin.minify(ast); // 'a=(1+2-3)*4/5^6'

Author

twitter/mathias
Mathias Bynens

License

luamin is available under the MIT license.

About

A Lua minifier written in JavaScript

https://mths.be/luamin

License:MIT License


Languages

Language:JavaScript 100.0%