Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clean-css-promise

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clean-css-promise

clean-css with the default Promise interface and some improvements

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

clean-css-promise

npm version Github Actions codecov

clean-css with the default Promise interface and some improvements

const CleanCssPromise = require('clean-css-promise');

(async () => {
  const {styles} = await new CleanCssPromise().minify(`
p {
  color: #ff0000;
}

b {
  /* nothing */
}
`); //=> 'p{color:red}'
})();

Installation

Use npm.

npm install clean-css-promise

API

const CleanCssPromise = require('clean-css-promise');

class CleanCssPromise([options])

options: Object (clean-css constructor options)

Almost the same the original clean-css, except for:

  • returnPromise option is enabled by default, and cannot be disabled.
  • onRejected function receives an Error instead of an Array.
  • All problems that clean-css considers as warnings, for example broken CSS syntax, are regarded as errors.
const CleanCssPromise = require('clean-css-promise');

new CleanCssPromise({})
.minify('@import url(/foo);}')
.catch(err => {
  err.message;
  /*=> `2 errors found while optimizing CSS with clean-css:
  1. Ignoring local @import of "/foo" as resource is missing.
  2. Invalid character(s) '?' at 1:18. Ignoring.

clean-css dangerously ignores these errors but clean-css-promise doesn't, because it's much more reasonable to update the CSS to fix all problems than to pretend that you didn't see the errors.` */
});

License

ISC License © 2017 - 2019 Watanabe Shinnosuke

Keywords

FAQs

Package last updated on 10 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc