# precss

> Use Sass-like markup and staged CSS features in CSS

Latest version **4.0.0** (published 2018-11-23) · CC0-1.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install precss
pnpm add precss
yarn add precss
bun add precss
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2018-11-23 |
| First published | 2015-07-08 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=4.0.0 |
| Dependencies | 7 |
| Unpacked size | 17.7 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1589 |
| Author | Jonathan Neal |
| Maintainers | jonathantneal |
| Keywords | postcss, css, postcss-plugin, sass, scss, variables, conditionals, iterations, iterators, iterables, iterate, contents, eaches, elses, fors, ifs, includes, imports, medias, queries, query, mixins, defaults, functions, colors, customs, dirs, system-ui, image-set, logical, properties, blocks, inlines, starts, ends, any-link, font-variant, overflow-wrap, system-ui, caniuse |

## Links

- npm: https://www.npmjs.com/package/precss
- Repository: https://github.com/jonathantneal/precss
- Homepage: https://github.com/jonathantneal/precss#readme
- Issues: https://github.com/jonathantneal/precss/issues
- npm.io page: https://npm.io/package/precss

## Dependencies (7)

- [postcss](https://npm.io/package/postcss.md) ^7.0.6
- [postcss-atroot](https://npm.io/package/postcss-atroot.md) ^0.1.3
- [postcss-nested](https://npm.io/package/postcss-nested.md) ^4.1.0
- [postcss-preset-env](https://npm.io/package/postcss-preset-env.md) ^6.4.0
- [postcss-extend-rule](https://npm.io/package/postcss-extend-rule.md) ^2.0.0
- [postcss-property-lookup](https://npm.io/package/postcss-property-lookup.md) ^2.0.0
- [postcss-advanced-variables](https://npm.io/package/postcss-advanced-variables.md) ^3.0.0

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2018-11-23
- 3.1.2 — 2018-02-28
- 3.1.1 — 2018-02-21
- 3.1.0 — 2018-01-22
- 3.0.0 — 2018-01-17
- 2.0.0 — 2017-06-29
- 1.4.0 — 2015-12-31
- 1.3.0 — 2015-10-22
- 1.2.3 — 2015-09-24
- 1.2.2 — 2015-09-24
- 1.2.1 — 2015-09-24
- 1.2.0 — 2015-09-24
- 1.1.3 — 2015-09-14
- 1.1.2 — 2015-09-08
- 1.1.1 — 2015-09-08
- … 10 more at https://npm.io/package/precss/versions

## README

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

[![NPM Version][npm-img]][npm-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]

[PreCSS] lets you use Sass-like markup and staged CSS features in CSS.

```scss
$blue: #056ef0;
$column: 200px;

.menu {
  width: calc(4 * $column);
}

.menu_link {
  background: $blue;
  width: $column;
}

/* becomes */

.menu {
  width: calc(4 * 200px);
}

.menu_link {
  background: #056ef0;
  width: 200px;
}
```

PreCSS combines Sass-like syntactical sugar — like variables, conditionals, and
iterators — with emerging CSS features — like logical and custom properties,
media query ranges, and image sets.

## Usage

Add [PreCSS] to your build tool:

```bash
npm install precss --save-dev
```

#### Node

Use [PreCSS] to process your CSS:

```js
import precss from 'precss';

precss.process(YOUR_CSS);
```

#### PostCSS

Add [PostCSS] to your build tool:

```bash
npm install postcss --save-dev
```

Use [PreCSS] as a plugin:

```js
import postcss from 'postcss';
import precss from 'precss';

postcss([
  precss(/* options */)
]).process(YOUR_CSS);
```

#### Gulp

Add [Gulp PostCSS] to your build tool:

```bash
npm install gulp-postcss --save-dev
```

Use [PreCSS] in your Gulpfile:

```js
import postcss from 'gulp-postcss';
import precss from 'precss';

gulp.task('css', function () {
  return gulp.src('./src/*.css').pipe(
    postcss([
      precss(/* options */)
    ])
  ).pipe(
    gulp.dest('.')
  );
});
```

#### Grunt

Add [Grunt PostCSS] to your build tool:

```bash
npm install grunt-postcss --save-dev
```

Use [PreCSS] in your Gruntfile:

```js
import precss from 'precss';

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
  postcss: {
    options: {
      use: [
        precss(/* options */)
      ]
    },
    dist: {
      src: '*.css'
    }
  }
});
```

# Plugins

PreCSS is powered by the following plugins (in this order):

- [postcss-extend-rule](https://github.com/jonathantneal/postcss-extend-rule)
- [postcss-advanced-variables](https://github.com/jonathantneal/postcss-advanced-variables)
- [postcss-preset-env](https://github.com/jonathantneal/postcss-preset-env)
- [postcss-atroot](https://github.com/OEvgeny/postcss-atroot)
- [postcss-property-lookup](https://github.com/simonsmith/postcss-property-lookup)
- [postcss-nested](https://github.com/postcss/postcss-nested)

[cli-img]: https://img.shields.io/travis/jonathantneal/precss/master.svg
[cli-url]: https://travis-ci.org/jonathantneal/precss
[git-img]: https://img.shields.io/badge/chat-gitter-blue.svg
[git-url]: https://gitter.im/postcss/postcss
[npm-img]: https://img.shields.io/npm/v/precss.svg
[npm-url]: https://www.npmjs.com/package/precss

[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
[PostCSS]: https://github.com/postcss/postcss
[PreCSS]: https://github.com/jonathantneal/precss

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