# @web-alchemy/eleventy-plugin-css

> Eleventy plugin for CSS

Latest version **0.0.1** (published 2023-06-30) · 0 weekly downloads

## Install

```sh
npm install @web-alchemy/eleventy-plugin-css
pnpm add @web-alchemy/eleventy-plugin-css
yarn add @web-alchemy/eleventy-plugin-css
bun add @web-alchemy/eleventy-plugin-css
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-06-30 |
| First published | 2023-06-30 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | monochromer |
| Keywords | eleventy, eleventy-plugin, css, postcss |

## Links

- npm: https://www.npmjs.com/package/@web-alchemy/eleventy-plugin-css
- Repository: https://github.com/web-alchemy/eleventy-plugin-css
- Issues: https://github.com/web-alchemy/eleventy-plugin-css/issues
- npm.io page: https://npm.io/package/@web-alchemy/eleventy-plugin-css

## Dependencies (4)

- [postcss](https://npm.io/package/postcss.md) ^8.4.24
- [autoprefixer](https://npm.io/package/autoprefixer.md) ^10.4.14
- [postcss-csso](https://npm.io/package/postcss-csso.md) ^6.0.1
- [postcss-import](https://npm.io/package/postcss-import.md) ^15.1.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2023-06-30

## README

# Eleventy plugin for CSS

## Installation

```sh
npm install @web-alchemy/eleventy-plugin-css
```

## Configuration

```javascript
const EleventyPluginCSS = require('@web-alchemy/eleventy-plugin-css')

module.exports = function(eleventyConfig) {
  eleventyConfig.addPlugin(EleventyPluginCSS, {
    // function for filtering files to be processed
    // by default, all CSS files are processed in input directory
    filter(inputContent, inputPath) {
      return !inputPath.includes('components')
        && !inputPath.includes('blocks')
    },
    
    // plugins for `postcss` (https://github.com/postcss/postcss)
    // default:
    postcssPlugins: [
      require('postcss-import'),
      require('autoprefixer'),
      process.env.NODE_ENV === 'production' && require('postcss-csso'),
    ]
  })

  return {
    dir: {
      input: 'src'
    }
  }
}
```

## Usage

```css
---
permalink: '/assets/main.css'
---
@charset 'utf-8';

@import 'components/header.css';
@import 'components/footer.css';
@import 'components/button.css';
```
Plugin provides Eleventy async filter for processing styles. Example for nunjucks:

```nunjucks
{% set styles %}
.header {
  display: flex;
}
{% endset %}

<style>{{ styles | processStyles }}</style>
```

---
_Source: https://npm.io/package/@web-alchemy/eleventy-plugin-css · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
