website-minifier

An HTML, CSS, and JS minifier for Atom

bossley9

5,395

3

1.4.0

MIT

GitHub

website-minifier

This plugin aims to reduce webpage loading speeds by minifying HTML, CSS, and JS files.

Given any HTML file, when activated, the plugin will replace the HTML with a minified duplicate of the code. It then will generate a .max.html file with the original un-minified document's contents.

When minifying, the plugin removes all HTML, CSS, and JS commented code, then removes all white space (keeping track of any strings in single or double quotes).

The plugin can then be used on the .max.html file to update the original HTML file.

index.max.html:

<section>
  <!-- title -->
  <h2>Sushi:</h2>
  <p>Great with soy sauce!</p>
</section>
<span>
  /* Mine is the Frozen Sunbeam from Dragon King's Daughter! */
  alert('What\'s your favorite sushi roll?');
</span>

index.html:

<section><!-- title --><h2>Sushi:</h2><p>Great with soy sauce!</p></section><span>alert('What\'s your favorite sushi roll?');</span>

Notice that this minifier does not remove HTML comments. This is due to the possibility of accidentally removing CDATA blocks or literal text blocks.

The website-minifier plugin can be activated by selecting "Packages > website-minifier > minify" in the menu, or by pressing CTRL+ALT+M.

New Features:

Babel/ES6 support now added!

If inline Javacript is enabled, website-minifier will inline all scripts, including scripts containing ECMAScript 2015 specifications.

Any ECMAScript 2015+ script:

const random = (x) => {
  return x + 7;
}

Will be converted to ES5 JS:

var random = function(x) {
  return x + 7;
}

Suggestions?

If there are any suggestions for new features you would like to see added, please let me know and I will consider implementing them in future versions.

Good luck coding 😃