kangax / kangax/html-minifier

Add callback to minifyCSS and minifyJS functions to allow for asynchronous calls.

Open
#906 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
577
PR merge metrics
No merged PRs in 30d

Description

Currently the functions `minifyCSS` and `minifyJS` cannot perform any asynchronous calls. It would be a really nice enhancement to add callback support.

### Example of possible new syntax

```js
var minify = require('html-minifier').minify;
var html = 'body { margin: 0; display: flex; }';

var result = minify(html, {
minifyCSS: function(css, callback) {
doSomethingAsync(css, function(updatedCss) {
callback(updatedCss);
});
}
});
```

This enhancement can be added without any changes to the way synchronous code is executed.

Related: #900

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.