# postcss-host

> PostCSS plugin to make :host selector works properly with pseudo-classes

Latest version **2.0.1** (published 2020-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-host
pnpm add postcss-host
yarn add postcss-host
bun add postcss-host
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2020-12-10 |
| First published | 2015-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Victor Karpov |
| Maintainers | vitkarpov |
| Keywords | postcss, webcomponents |

## Links

- npm: https://www.npmjs.com/package/postcss-host
- Repository: https://github.com/vitkarpov/postcss-host
- Homepage: https://github.com/vitkarpov/postcss-host#readme
- Issues: https://github.com/vitkarpov/postcss-host/issues
- npm.io page: https://npm.io/package/postcss-host

## Recent versions

- 2.0.1 (latest) — 2020-12-10
- 1.1.2 — 2015-05-25
- 1.1.1 — 2015-05-25
- 1.1.0 — 2015-05-25
- 1.0.5 — 2015-05-24
- 1.0.4 — 2015-02-09
- 1.0.3 — 2015-02-09
- 1.0.2 — 2015-02-09
- 1.0.1 — 2015-02-09
- 1.0.0 — 2015-02-09

## README

# postcss-host

> [PostCSS](https://github.com/postcss/postcss) plugin to make :host selectors work properly with pseudo-classes

## What is it about?

If you work with Shadow DOM and web components then you're probably familiar with `:host` selector. It has some features.

Instead of

```css
:host:hover {
    ...
}

:host.bar {
    ...
}
```

you should write

```css
:host(:hover) {
    ...
}

:host(.bar) {
    ...
}
```

Postcss-host transforms the first into the second.

It might be useful when CSS is produced automatically by a preprocessor.

## Installation

```console
$ npm install postcss-host
```

## Usage

```js
// dependencies
var fs = require("fs")
var postcss = require("postcss")
var postcssHost = require("postcss-host")

// css to be processed
var css = fs.readFileSync("input.css", "utf8")

// process css
var output = postcss([postcssHost])
  .process(css, {
    from: "src/index.css"
    to: "dist/index.css"
  })
  .css
```

Checkout [tests](test) for examples.

## Contributing

Work on a branch

```console
$ git clone https://github.com/vitkarpov/postcss-host.git
$ git checkout -b patch-1
$ npm install
$ npm test
```

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