Code Monkey home page Code Monkey logo

lua-minify's Introduction

ARCHIVED PROJECT, I won't be updating this (though I might revisit the idea in the future)

lua-minify

lua-minify is a Lua library to minify html5 and css3. It's written in pure Lua 5.3, and it's written using test-driven development.

The project's name isn't definitive, and might/will change, as there are already a few projects named lua-minify.

Warning

Before you start using lua-minify, you need to know a few assumptions that it makes:

  • You don't mess with the white-space CSS property. Only <pre> tags will keep the data as it is in the source file.
  • You don't put code in comments (IE's conditional comments are stupid, why are you even trying to support IE?)
  • It doesn't optimize inline javascript. You probably shouldn't be using inline javascript anyway.
  • It doesn't support non-standard tags: if you use a framework like vue, and you create a tag starting with pre (for exemple), it will break the parser.
  • It doesn't support twig/jinja/django and other templating engines. you should only use lua-minify on pure HTML5 and CSS3.

Current status

HTML

Everything should pretty much work as-is. CSS isn't optimized, since the CSS minifier isn't written yet.

lua-minify's People

Contributors

cafehaine avatar

Stargazers

 avatar

Watchers

 avatar

lua-minify's Issues

html: spaces are removed where they shouldn’t

for example <p> a </p> would result in <p>a</p> which isn’t displayed the same way.

One way to fix this is to remove all spaces outside of the <body> element, and inside only keep one space when there are multiple.

Rewrite most of this stuff.

After some thinking, I think it would be a better thing to create three separate libraries:

  • A CSS parser
  • An HTML parser
  • A minifyer.

Lua-minfy would then only handle the minifying of the trees generated by the parsers.

This would create a better separation of functionalities, and more importantly no longer rely on a really naive html parser that I wrote only for minifying.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.