Skip to content

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

Open
@RebeccaStevens

Description

@RebeccaStevens

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

var minify = require('html-minifier').minify;
var html = '<html><head><style>body { margin: 0; display: flex; }</style></head></html>';

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions