# postcss-mq-last

> PostCSS plugin that gives media query rules precedence by moving them to the end of the file

Latest version **2.0.0** (published 2026-01-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-mq-last
pnpm add postcss-mq-last
yarn add postcss-mq-last
bun add postcss-mq-last
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

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

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-01-05 |
| First published | 2018-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | J |
| Maintainers | jgjp |
| Keywords | postcss, css, postcss-plugin, media, query, last, precedence |

## Links

- npm: https://www.npmjs.com/package/postcss-mq-last
- Repository: https://github.com/jgjp/postcss-mq-last
- Issues: https://github.com/jgjp/postcss-mq-last/issues
- npm.io page: https://npm.io/package/postcss-mq-last

## 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

- 2.0.0 (latest) — 2026-01-05
- 1.0.2 — 2018-01-18
- 1.0.1 — 2018-01-17
- 0.0.0 — 2018-01-17

## README

# PostCSS Mq Last [![Build Status][ci-img]][ci]

[PostCSS] plugin that gives media query rules precedence by moving them to the end of the file.

Sometimes, when working with nesting plugins, media atrules are output before otherwise-identical rules.

Since media queries don't raise specificity, this plugin moves media atrules to the end of the output, making them override non-media query rules.

[PostCSS]: https://github.com/postcss/postcss
[ci-img]:  https://travis-ci.org/JGJP/postcss-mq-last.svg
[ci]:      https://travis-ci.org/JGJP/postcss-mq-last

Input:

```css
@media (max-width: 34em) {
    .half.stackable {
    	width: 100%
    }
}

.half.stackable {
	width: 50%
}
```

Output:

```css
.half.stackable {
	width: 50%
}

@media (max-width: 34em) {
    .half.stackable {
    	width: 100%
    }
}
```

## Usage

```js
postcss([ require('postcss-mq-last') ])
```

See [PostCSS] docs for examples for your environment.

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