# @gatsbylabs/vite-plugin-minify-template-literals

> Minify tagged template literal strings for styled components and graphql by removing white space. Template literals tagged with `gql`, `css`, and `styled.*` will be minified. This can shave some bytes off your total bundle size without changing applicatio

Latest version **2.0.3** (published 2024-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gatsbylabs/vite-plugin-minify-template-literals
pnpm add @gatsbylabs/vite-plugin-minify-template-literals
yarn add @gatsbylabs/vite-plugin-minify-template-literals
bun add @gatsbylabs/vite-plugin-minify-template-literals
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2024-08-09 |
| First published | 2022-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Enoch Chau |
| Maintainers | ec965, emilyhoward, mikezuccarino |
| Keywords | vite, plugin, template literal, minify, css, styled components, gql, graphql |

## Links

- npm: https://www.npmjs.com/package/@gatsbylabs/vite-plugin-minify-template-literals
- Repository: https://github.com/gatsbylabs/vite-plugin-minify-template-literals
- Homepage: https://github.com/gatsbylabs/vite-plugin-minify-template-literals#readme
- Issues: https://github.com/gatsbylabs/vite-plugin-minify-template-literals/issues
- npm.io page: https://npm.io/package/@gatsbylabs/vite-plugin-minify-template-literals

## Dependencies (4)

- [graphql](https://npm.io/package/graphql.md) ^16.5.0
- [magic-string](https://npm.io/package/magic-string.md) ^0.26.2
- [parse-literals](https://npm.io/package/parse-literals.md) ^1.2.1
- [babel-plugin-styled-components](https://npm.io/package/babel-plugin-styled-components.md) ^2.0.7

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 2.0.3 (latest) — 2024-08-09
- 2.0.2 — 2024-08-09
- 2.0.1 — 2024-08-09
- 2.0.0 — 2024-08-09
- 1.0.1 — 2024-08-09
- 1.0.0 — 2022-07-30

## README

# Vite Plugin Minify Template Literals

Minify tagged template literal strings for styled components and graphql by removing white space.
Template literals tagged with `gql`, `css`, and `styled.*` will be minified.
This can shave some bytes off your total bundle size without changing application code.

```js
import gql from "graphql-tag";

const query = gql`
  {
    user(id: 5) {
      firstName
      lastName
    }
  }
`;

// becomes gql`{user(id:5)}{firstName lastName}}`
```

## Usage

```ts
// vite.config.ts
import { defineConfig } from "vite";
import { plugin as templateLiteralPlugin } from "@gatsbylabs/vite-plugin-minify-template-literals";

defineConfig({
  plugins: [templateLiteralPlugin()],
});
```

### Options

```ts
export interface Options {
  css?: boolean; // default is true, set to false to disable css/styled.* minification
  gql?: boolean; // default is true, set to false to disable gql minification
}
```

---

Created and maintained by [Enoch Chau](https://enochchau.com) and the engineers at [Gatsby Labs](https://gatsby.events).

---
_Source: https://npm.io/package/@gatsbylabs/vite-plugin-minify-template-literals · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
