Skip to content

Super-fast alternative for minify-html-literals. [WIP]

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE.md
MIT
THIRD_PARTY_LICENSE.md
Notifications You must be signed in to change notification settings

importantimport/literals

Repository files navigation

Literals [WIP]

Packages

@importantimport/minify-html-literals

Super-fast alternative for minify-html-literals.

import { minifyHTMLLiterals } from '@importantimport/minify-html-literals'

const result = minifyHTMLLiterals(
  `function render(title, items) {
    return html\`
      <style>
        .heading {
          color: blue;
        }
      </style>
      <h1 class="heading">\${title}</h1>
      <ul>
        \${items.map(item => {
          return getHTML()\`
            <li>\${item}</li>
          \`;
        })}
      </ul>
    \`;
  }`,
)

console.log(result.code)
// function render(title, items) {
//     return html`<style>.heading{color:#00f}</style><h1 class="heading">${title}</h1><ul>${items.map((item)=>{
//         return getHTML()`
//             <li>${item}</li>
//           `;
//     })}</ul>`;
// }

@importantimport/unplugin-minify-html-literals

Super-fast alternative for rollup-plugin-minify-html-literals.

// vite.config.ts
import minifyHTML from '@importantimport/unplugin-minify-html-literals'
import { defineConfig } from 'vite'

export default defineConfig({
  ...config,
  plugins: [
    minifyHTML.vite(),
    ...plugins,
  ],
})

License

licensed under the MIT.

partially copies code from the following projects, their licenses are listed in Third-party library licenses.

Project License
asyncLiz/parse-literals MIT
asyncLiz/minify-html-literals MIT

About

Super-fast alternative for minify-html-literals. [WIP]

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE.md
MIT
THIRD_PARTY_LICENSE.md

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published