# posthtml-style-to-file **Repository Path**: mirrors_posthtml/posthtml-style-to-file ## Basic Information - **Project Name**: posthtml-style-to-file - **Description**: Save DOM styles to CSS file - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-25 - **Last Updated**: 2025-09-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![NPM][npm]][npm-url] [![Deps][deps]][deps-url] [![Tests][travis]][travis-url] [![Coverage][cover]][cover-url]

Style-to-File Plugin

Save DOM styles to CSS file

Install

```bash npm i -D posthtml-style-to-file ```

Usage

## Options #### `path` Type: `String` Default: `./result.css` Description: *Destination path, where the extracted CSS is saved to.* #### `removeStyle` Type: `String` Default: `` Description: *Removes the specified value `attrs` | `tag` | `all`* __`removeStyle`__ Destination path, where the extracted CSS is saved to.

Example

```js const posthtml = require('posthtml') const styleToFile = require('posthtml-style-to-file') const html = readFileSync('path/to/html', 'utf8') posthtml([ styleToFile({ path: './dist/style.css' }) ]) .process(html) .then((result) => console.log(result.html)) ``` __index.html__ ```html Wow
Text
``` __style.css__ ```css html{ margin: 0 } body{ background: #fff; } div.button{ border: 1px solid #000; } ``` [npm]: https://img.shields.io/npm/v/posthtml-style-to-file.svg [npm-url]: https://npmjs.com/package/posthtml-style-to-file [deps]: https://david-dm.org/posthtml/posthtml-style-to-file.svg [deps-url]: https://david-dm.org/posthtml/posthtml-style-to-file [style]: https://img.shields.io/badge/code%20style-standard-yellow.svg [style-url]: http://standardjs.com/ [travis]: http://img.shields.io/travis/posthtml/posthtml-style-to-file.svg [travis-url]: https://travis-ci.org/posthtml/posthtml-style-to-file [cover]: https://coveralls.io/repos/github/posthtml/posthtml-style-to-file/badge.svg [cover-url]: https://coveralls.io/github/posthtml/posthtml-style-to-file