An open API service indexing awesome lists of open source software.

https://github.com/importantimport/literals

Super-fast alternative for minify-html-literals. [WIP]
https://github.com/importantimport/literals

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# Literals [WIP]

## Packages

### `@importantimport/minify-html-literals`

Super-fast alternative for `minify-html-literals`.

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

const result = minifyHTMLLiterals(
`function render(title, items) {
return html\`

.heading {
color: blue;
}

\${title}



    \${items.map(item => {
    return getHTML()\`
  • \${item}

  • \`;
    })}

\`;
}`,
)

console.log(result.code)
// function render(title, items) {
// return html`.heading{color:#00f}

${title}

    ${items.map((item)=>{
    // return getHTML()`
    //
  • ${item}

  • // `;
    // })}
`;
// }
```

### `@importantimport/unplugin-minify-html-literals`

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

```ts
// 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](./LICENSE.md).

partially copies code from the following projects, their licenses are listed in [**Third-party library licenses**](./THIRD-PARTY-LICENSE.md).

| Project | License |
| ------------- | ------------- |
| [asyncLiz/parse-literals](https://github.com/asyncLiz/parse-literals) | [MIT](https://github.com/asyncLiz/parse-literals/blob/master/LICENSE.md) |
| [asyncLiz/minify-html-literals](https://github.com/asyncLiz/minify-html-literals) | [MIT](https://github.com/asyncLiz/minify-html-literals/blob/master/LICENSE.md) |