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]
- Host: GitHub
- URL: https://github.com/importantimport/literals
- Owner: importantimport
- License: mit
- Created: 2023-09-03T14:56:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-03T08:47:17.000Z (over 2 years ago)
- Last Synced: 2024-04-28T05:13:42.951Z (about 2 years ago)
- Language: TypeScript
- Homepage:
- Size: 163 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
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}
- \${item}
\${items.map(item => {
return getHTML()\`
\`;
})}
\`;
}`,
)
console.log(result.code)
// function render(title, items) {
// return html`.heading{color:#00f}
${title}
- ${items.map((item)=>{
- ${item}
// return getHTML()`
//
// `;
// })}
// }
```
### `@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) |