# postcss-theme-fallback

> [![NPM Version][npm-img]][npm-url] [![github (ci)][github-ci]][github-ci]

Latest version **1.0.0** (published 2021-01-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-theme-fallback
pnpm add postcss-theme-fallback
yarn add postcss-theme-fallback
bun add postcss-theme-fallback
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-01-23 |
| First published | 2021-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 (+7 in 1 direct dependencies) |
| Install scripts | no |
| Author | Eugene Tropin |
| Maintainers | yarastqt |
| Keywords | postcss, postcss-plugin, css variable |

## Links

- npm: https://www.npmjs.com/package/postcss-theme-fallback
- npm.io page: https://npm.io/package/postcss-theme-fallback

## Dependencies (2)

- [postcss](https://npm.io/package/postcss.md) 7.0.24
- [postcss-import](https://npm.io/package/postcss-import.md) 12.0.1

## Recent versions

- 1.0.0 (latest) — 2021-01-23

## README

# postcss-theme-fallback [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss]

[![NPM Version][npm-img]][npm-url] [![github (ci)][github-ci]][github-ci]

A postcss plugin to adding fallback values for css-variables.

## ✈️ Install

```sh
npm i -DE postcss-theme-fallback
```

## ☄️ Usage

```js
// postcss.config.js
module.exports = {
  plugins: [
    require('postcss-theme-fallback')({
      // Use variables from object:
      variables: {
        '--var-a': '10px',
        '--var-b': '20px',
      },
      // Or load variables from theme:
      // themeSource: './src/theme/acme.css',
    }),
  ],
}
```

### Options

| Name                                                              | Description                                            | Default |
|-------------------------------------------------------------------|--------------------------------------------------------|---------|
| `variables` *Record<string, string>*                              | Object with theme variables                            |         |
| `themeSource` *string* | A source path to theme, uses for extract css-variables |         |
| `silent?` *boolean*                                               | Disable warnings output                                | false   |

## 🌈 Example

```css
/* input.css */
.component {
  width: var(--var-a);
}

/* output.css */
.component {
  width: var(--var-a, 10px);
}
```

## License

Project is [MIT licensed](https://github.com/yarastqt/postcss-theme-fallback/blob/master/LICENSE.md).

[npm-img]: https://img.shields.io/npm/v/postcss-theme-fallback.svg
[npm-url]: https://www.npmjs.com/package/postcss-theme-fallback
[github-ci]: https://github.com/yarastqt/postcss-theme-fallback/workflows/ci/badge.svg?branch=master
[PostCSS]: https://github.com/postcss/postcss

---
_Source: https://npm.io/package/postcss-theme-fallback · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
