/quick-minifier

Quickly JavaScript and CSS minifier using Toptal API.

Primary LanguageJavaScriptMIT LicenseMIT

quick-minifier

Contents

About

Quickly JavaScript and CSS minifier using Toptal API.

Installation

npm install quick-minifier

Examples

JavaScript

const quickminifier = require("quick-minifier");
var code = `
  $(function() {
    $("#app").html("Hello, World!");
  });
`;

quickminifier.js(code).then(minified_code => {
  console.log(minified_code);
  /*
    $(function(){$("#app").html("Hello, World!")});
  */
}).catch(err => {
  console.error(err);
});

CSS

const quickminifier = require("quick-minifier");
var code = `
  body {
    text-align: center;
    font-family: arial;
    font-size: 16px
  }

  h1 {
    color: #2E2EFF;
  }
`;

quickminifier.css(code).then(minified_code => {
  console.log(minified_code);
  /*
    body{text-align:center;font-family:arial;font-size:16px}h1{color:#2e2eff}
  */
}).catch(err => {
  console.error(err);
});

License

MIT