# @financial-times/dotcom-build-css

> This package exports a Webpack plugin to configure it with a way to load CSS source files.

Latest version **13.12.0** (published 2026-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @financial-times/dotcom-build-css
pnpm add @financial-times/dotcom-build-css
yarn add @financial-times/dotcom-build-css
bun add @financial-times/dotcom-build-css
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 13.12.0 |
| Published | 2026-07-21 |
| First published | 2019-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | 18.x \|\| 20.x \|\| 22.x |
| Dependencies | 4 |
| Unpacked size | 59.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | the-ft, rowanmanning, chee, alexwilson, aendra, emmalewis, notlee, hamza.samih, robertboulton, leila.micollier, robgodfrey |

## Links

- npm: https://www.npmjs.com/package/@financial-times/dotcom-build-css
- Homepage: https://github.com/Financial-Times/dotcom-page-kit/tree/HEAD/packages/dotcom-build-css
- npm.io page: https://npm.io/package/@financial-times/dotcom-build-css

## Dependencies (4)

- [css-loader](https://npm.io/package/css-loader.md) ^6.8.1
- [mini-css-extract-plugin](https://npm.io/package/mini-css-extract-plugin.md) ^2.9.1
- [css-minimizer-webpack-plugin](https://npm.io/package/css-minimizer-webpack-plugin.md) ^7.0.0
- [webpack-remove-empty-scripts](https://npm.io/package/webpack-remove-empty-scripts.md) ^1.0.4

## Recent versions

- 13.12.0 (latest) — 2026-07-21
- 13.13.0-beta.2 (pre-release) — 2026-08-25
- 13.11.0 — 2026-07-13
- 13.10.1-beta.2 — 2026-07-10
- 13.10.1-beta.1 — 2026-07-06
- 13.10.0 — 2026-04-27
- 13.10.0-beta.1 — 2026-04-21
- 13.9.2 — 2026-03-26
- 13.9.1 — 2026-03-25
- 13.9.1-beta.1 — 2026-03-25
- 13.9.0 — 2026-03-18
- 13.8.1 — 2026-03-10
- 13.8.1-beta.0 — 2026-03-10
- 13.8.0 — 2026-03-05
- 13.8.0-beta.0 — 2026-03-05
- … 57 more at https://npm.io/package/@financial-times/dotcom-build-css/versions

## README

# @financial-times/dotcom-build-css

This package exports a Webpack plugin to configure it with a way to load CSS source files.

## Getting started

This package is compatible with Node 18+ and is distributed on npm.

```sh
npm install --save-dev @financial-times/dotcom-build-css
```

After installing the package you must add it to the list of plugins in your project's `webpack.config.js` configuration file:

```diff
+ const { PageKitCssPlugin } = require('@financial-times/dotcom-build-css')

module.exports = {
  plugins: [
+    new PageKitCssPlugin()
  ]
}
```

Once setup, this plugin will enable you to use CSS files (`.css`) as entry points into your source code.

```js
const { PageKitCssPlugin } = require('@financial-times/dotcom-build-css')

module.exports = {
   entry: {
      styles: path/to/styles.css
   },
   plugins: [new PageKitCssPlugin()]
}
```

## Scope

This plugin adds a [rule] to the Webpack configuration to handle `.css` files. It calls the [css-loader] package to load and parse the source files. The CSS is optimised using [css-minimizer-webpack-plugin], which runs [cssnano] under the hood. The [mini-css-extract-plugin] is added to generate `.css` files and the [webpack-fix-style-only-entries] to clean up any empty JavaScript bundles.

The CSS loader has `url()` resolution disabled as we don't use, nor recommend, the function currently.

[rule]: https://webpack.js.org/configuration/module/#rule
[css-loader]: https://github.com/webpack-contrib/css-loader
[css-minimizer-webpack-plugin]: https://github.com/webpack-contrib/css-minimizer-webpack-plugin
[mini-css-extract-plugin]: https://github.com/webpack-contrib/mini-css-extract-plugin
[webpack-fix-style-only-entries]: https://github.com/fqborges/webpack-fix-style-only-entries
[cssnano]: https://cssnano.co/

---
_Source: https://npm.io/package/@financial-times/dotcom-build-css · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
