lib/pre-commit/pre-commit-base.js
function extractStyles(src) {
	var isInBlock = false,
		lines = [];

	src.replace(/\r/g, "").split("\n").forEach(function(l) {
		// we're at the end of the style tag
		if (l.indexOf("</style") > -1) {
			lines[lines.length] = "";
			isInBlock = false;
			return;
		}
		if (isInBlock) {
			lines[lines.length] = l;
		} else {
			lines[lines.length] = "";
		}
		if (l.indexOf("<style") > -1) {
			isInBlock = true;
		}
	});
	return lines.join("\n").replace(/\{\$(\w+\.)*\w+\}/g, "{}");
}
function extractStyles(src) {
	var isInBlock = false,
		lines = [];

	src.replace(/\r/g, "").split("\n").forEach(function(l) {
		// we're at the end of the style tag
		if (l.indexOf("</style") > -1) {
			lines[lines.length] = "";
			isInBlock = false;
			return;
		}
		if (isInBlock) {
			lines[lines.length] = l;
		} else {
			lines[lines.length] = "";
		}
		if (l.indexOf("<style") > -1) {
			isInBlock = true;
		}
	});
	return lines.join("\n").replace(/\{\$(\w+\.)*\w+\}/g, "{}");
}
function extractStyles ( src ) { var isInBlock = false , lines = [ ] ; src . replace ( / \r / g , "" ) . split ( "\n" ) . forEach ( function ( l ) { // we're at the end of the style tag if ( l . indexOf ( "</style" ) > - 1 ) { lines [ lines . length ] = "" ; isInBlock = false ; return ; } if ( isInBlock ) { lines [ lines . length ] = l ; } else { lines [ lines . length ] = "" ; } if ( l . indexOf ( "<style" ) > - 1 ) { isInBlock = true ; } } ) ; return lines . join ( "\n" ) . replace ( / \{\$(\w+\.)*\w+\} / g , "{}" ) ; }
Replace non css content in a html file with empty lines
@param {String} src
@returns {String}
Replace non css content in a html file with empty lines