pull-minify-css

0.3.0 • Public • Published

pull-minify-css

Minify CSS files or buffers inside a pull-stream

Minifies streamed CSS files with csso

const pull = require('pull-stream')
const { read, write } = require('pull-files')
const minify = require('pull-minify-css')
 
pull(
  read(__dirname + '/src/css/**/*.css'),
  minify({ restructure: true }),
  write(__dirname + '/out/css', err => {
    // done
  })
)

Install

npm install --save pull-minify-css
yarn add pull-minify-css

Usage

minify(options?)

Minifies streamed files. See csso's options to use here

pull(
  read([ 'index.css', 'foo.css' ], { cwd: __dirname }),
  minify({ ...options }),
  write(__dirname + '/out', err => {
    // done
  })
)

You can disable errors for non-CSS files by doing:

minify({ strict: false, ...options })

minify.buffer(options?)

Minifies buffers instead of files. Options the same

pull(
  readFile(__dirname + '/foo.css'),
  minify.buffer({ ...options }),
  writeFile(__dirname + '/out.css')
)

Also see


Maintained by Jamen Marz (See on Twitter and GitHub for questions & updates)

Readme

Keywords

Package Sidebar

Install

npm i pull-minify-css

Weekly Downloads

1

Version

0.3.0

License

none

Last publish

Collaborators

  • npm