Deno.js WASM Source Code Minifier or Compressor Module Tutorial to Compress HTML,CSS,JSON,JS Code in TypeScript Full Project For Beginners




An awesome language minifier for Deno that is powered by WebAssembly!








To start using minifier with Deno, just add an import to the top of your file and get all of the features that you want to use from there! Here is an example import:




import { Language, minify } from "";



const code = `
html {
  margin: 0;
  padding: 0;

minify(Language.CSS, code);




Minifying Code




const code = `
html {
  margin: 0;
  padding: 0;

// both return the minifed CSS
minify(Language.CSS, code);
minify("css", code);



Minifying HTML



const code = `
    html {
      margin: 0;
      padding: 0;
    const x = 23;
    if (x > 20) {

// returns the minified HTML code with the CSS and JS code properly minified, too
minifyHTML(code, {
  minifyCSS: true,
  minifyJS: true,




Minifier even has its own CLI that allows you quickly minify files in your terminal.

See also  jsPDF Html2Canvas PDF Certificate Generator Project in Javascript Full Tutorial For Beginners


To install the CLI for minifier, run the following command:

deno install --allow-read --allow-write --allow-hrtime

We strongly suggest including the --allow-hrtime flag as it allows the performance benchmarks to be more accurate.


Command Action
<file-location> minifies the given file from the location specified
<file-location> <output-location> minifies the given file from the file location and saves it as the output file
-H--help provides info on all of the commands available
-V--version gives the version info for the CLI


Leave a Reply