lib/polymerize.js
function minifyHtml($) {
  $('style:not([type]), style[type="text/css"]').each(function() {
    var el      = $(this);
    el.text( new cleancss({noAdvanced: true}).minify(el.text()) )
  });
  $('*').contents().filter(function(_, node) {
    if (node.type === 'comment'){
      return true;
    } else if (node.type === 'text') {
      // return true if the node is only whitespace
      return !((/\S/).test(node.data));
    }
  }).remove();
}
function minifyHtml($) {
  $('style:not([type]), style[type="text/css"]').each(function() {
    var el      = $(this);
    el.text( new cleancss({noAdvanced: true}).minify(el.text()) )
  });
  $('*').contents().filter(function(_, node) {
    if (node.type === 'comment'){
      return true;
    } else if (node.type === 'text') {
      // return true if the node is only whitespace
      return !((/\S/).test(node.data));
    }
  }).remove();
}
function minifyHtml ( $ ) { $ ( 'style:not([type]), style[type="text/css"]' ) . each ( function ( ) { var el = $ ( this ) ; el . text ( new cleancss ( { noAdvanced : true } ) . minify ( el . text ( ) ) ) } ) ; $ ( '*' ) . contents ( ) . filter ( function ( _ , node ) { if ( node . type === 'comment' ) { return true ; } else if ( node . type === 'text' ) { // return true if the node is only whitespace return ! ( ( / \S / ) . test ( node . data ) ) ; } } ) . remove ( ) ; }
Optimize html source

Inspired by https://github.com/Polymer/vulcanize

@param {Object} $
Whacko document
Optimize html source