Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Add a marker (comment) that prevents the minifier from renaming table keys #85

Open
griffi-gh opened this issue May 31, 2022 · 3 comments
Labels
feature New feature or request

Comments

@griffi-gh
Copy link

No description provided.

@griffi-gh
Copy link
Author

griffi-gh commented May 31, 2022

the workaround is { ['name'] = value, ... } but it increases the size a bit

@nameouschangey
Copy link
Owner

This is in the works, as part of a large-scale set of changes being made to the minification process.

There is currently no simple way to implement this - so please bear with the long wait

@nameouschangey nameouschangey added the feature New feature or request label May 31, 2022
@griffi-gh
Copy link
Author

griffi-gh commented Jun 2, 2022

the workaround is { ['name'] = value, ... } but it increases the size a bit

Workaround for an issue (increased size) caused by this workaround:
Probably breaks at least some programs

function onLBBuildFileComplete(_, name, _, minimizedText, _, _)
    local file = assert(io.open(
        "./out/release/"..name:lower(),
        'wb'
    ))
    local mini2 = minimizedText:gsub("%['[a-z,_]'%]=", function(match)
        return ({match:gsub("%['", ""):gsub("'%]", "")})[1]
    end)
    file:write(mini2)
    file:close()
    print('total size: '..#mini2 ..' vs '..#minimizedText ..' chars; reduction: -'..(#minimizedText - #mini2)..' chars')
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants