GithubHelp home page GithubHelp logo

importantimport / unplugin-tdewolff-minify-html-literals Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 76 KB

๐Ÿ—œ๏ธ An Vite/Rollup/Webpack/esbuild/Rspack plugin to minify HTML template literal strings.

Home Page: https://www.npmjs.com/package/unplugin-tdewolff-minify-html-literals

License: MIT License

JavaScript 2.03% HTML 3.72% CSS 5.72% TypeScript 88.53%
unplugin html rollup-plugin template-literals vite-plugin

unplugin-tdewolff-minify-html-literals's Introduction

unplugin-tdewolff-minify-html-literals

npm minified size downloads

An Vite/Rollup/Webpack/esbuild/Rspack plugin to minify HTML template literal strings.

Not yet well tested and not recommended for production.

Features

  • This plugin uses @tdewolff/minify to get significant performance gains in complex projects.
    • Try it for yourself! Clone and run pnpm bench
  • Use unplugin to support multiple bundlers at the same time.

Usage

Install

pnpm add -D unplugin-tdewolff-minify-html-literals @tdewolff/minify # pnpm
# yarn add -D unplugin-tdewolff-minify-html-literals @tdewolff/minify # yarn
# npm i -D unplugin-tdewolff-minify-html-literals @tdewolff/minify # npm

Configuration

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

export default defineConfig({
  plugins: [
    minifyHTML({ /* options */ }),
  ],
})
Rollup
// rollup.config.js
import minifyHTML from 'unplugin-tdewolff-minify-html-literals/rollup'

export default {
  plugins: [
    minifyHTML({ /* options */ }),
  ],
}
Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-tdewolff-minify-html-literals/webpack')({ /* options */ })
  ]
}
esbuild
// esbuild.config.js
import { build } from 'esbuild'
import minifyHTML from 'unplugin-tdewolff-minify-html-literals/esbuild'

build({
  plugins: [minifyHTML({ /* options */ })],
})
Rspack
// rspack.config.js
module.exports = {
  plugins: [
    require('unplugin-tdewolff-minify-html-literals/rspack')({ /* options */ }),
  ],
}

Options

import { defineConfig } from 'vite'
import minifyHTML from 'unplugin-tdewolff-minify-html-literals/vite'

export default defineConfig({
  plugins: [
    minifyHTML({
      // minimatch of files to minify
      include: [],
      // minimatch of files not to minify
      exclude: [],
      // @tdewolff/minify config
      // https://www.npmjs.com/package/@tdewolff/minify#usage
      config: undefined,
    }),
  ],
})

Credits

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.