lib/css-purge.js
function processHTML(cssSelectors = [], htmlDataIn = null, htmlOptionsIn = null) {

		//read html files
		if (OPTIONS.html !== '' && OPTIONS.html !== undefined && OPTIONS.special_reduce_with_html) {

			var htmlFiles = OPTIONS.html;
			tmpHTMLPaths = [];

			//check for file or files
			switch (typeof htmlFiles) {
				case 'object':
				case 'array':
						
					for (i = 0; i < htmlFiles.length; ++i) {

						getFilePaths(htmlFiles[i], ['.html','.htm']);
					}

					if (tmpHTMLPaths.length) {
						htmlFiles = tmpHTMLPaths;
					}
					break;
				case 'string':
					//formats
					htmlFiles = htmlFiles.replace(/ /g, '');

					// comma delimited list - filename1.html, filename2.html
					if (htmlFiles.indexOf(',') > -1) { 
			
						htmlFiles = htmlFiles.replace(/^\s+|\s+$/g,'').split(',');
						tmpStr = '';
						for (i = 0; i < htmlFiles.length; ++i) {

							getFilePaths(htmlFiles[i], ['.html','.htm']);

						} //end of for

						if (tmpHTMLPaths.length) {
							htmlFiles = tmpHTMLPaths;
						}

					} else {

						//string path
						getFilePaths(htmlFiles, ['.html','.htm']);

						if (tmpHTMLPaths.length) {
							htmlFiles = tmpHTMLPaths;
						}

					}

					break;
			} //end of switch

			htmlFileLocation = (htmlFiles)?htmlFiles.toString():htmlFiles;

			readHTMLFile(htmlFiles);
			CPEVENTS.on('HTML_READ_AGAIN', function(){
				//process selectors
				processHTMLSelectors(cssSelectors, htmlDataIn, htmlOptionsIn);

				//read next file
				dataHTMLIn = [];
				readHTMLFile(htmlFiles);
			});
			CPEVENTS.on('HTML_READ_END', function(){
				//process selectors
				processHTMLSelectors(cssSelectors, htmlDataIn, htmlOptionsIn);

				dataHTMLIn = [];
				CPEVENTS.emit('HTML_RESULTS_END', cssSelectors);

			});


		} //end of html files check








	}
function processHTML(cssSelectors = [], htmlDataIn = null, htmlOptionsIn = null) {

		//read html files
		if (OPTIONS.html !== '' && OPTIONS.html !== undefined && OPTIONS.special_reduce_with_html) {

			var htmlFiles = OPTIONS.html;
			tmpHTMLPaths = [];

			//check for file or files
			switch (typeof htmlFiles) {
				case 'object':
				case 'array':
						
					for (i = 0; i < htmlFiles.length; ++i) {

						getFilePaths(htmlFiles[i], ['.html','.htm']);
					}

					if (tmpHTMLPaths.length) {
						htmlFiles = tmpHTMLPaths;
					}
					break;
				case 'string':
					//formats
					htmlFiles = htmlFiles.replace(/ /g, '');

					// comma delimited list - filename1.html, filename2.html
					if (htmlFiles.indexOf(',') > -1) { 
			
						htmlFiles = htmlFiles.replace(/^\s+|\s+$/g,'').split(',');
						tmpStr = '';
						for (i = 0; i < htmlFiles.length; ++i) {

							getFilePaths(htmlFiles[i], ['.html','.htm']);

						} //end of for

						if (tmpHTMLPaths.length) {
							htmlFiles = tmpHTMLPaths;
						}

					} else {

						//string path
						getFilePaths(htmlFiles, ['.html','.htm']);

						if (tmpHTMLPaths.length) {
							htmlFiles = tmpHTMLPaths;
						}

					}

					break;
			} //end of switch

			htmlFileLocation = (htmlFiles)?htmlFiles.toString():htmlFiles;

			readHTMLFile(htmlFiles);
			CPEVENTS.on('HTML_READ_AGAIN', function(){
				//process selectors
				processHTMLSelectors(cssSelectors, htmlDataIn, htmlOptionsIn);

				//read next file
				dataHTMLIn = [];
				readHTMLFile(htmlFiles);
			});
			CPEVENTS.on('HTML_READ_END', function(){
				//process selectors
				processHTMLSelectors(cssSelectors, htmlDataIn, htmlOptionsIn);

				dataHTMLIn = [];
				CPEVENTS.emit('HTML_RESULTS_END', cssSelectors);

			});


		} //end of html files check








	}
function processHTML ( cssSelectors = [ ] , htmlDataIn = null , htmlOptionsIn = null ) { //read html files if ( OPTIONS . html !== '' && OPTIONS . html !== undefined && OPTIONS . special_reduce_with_html ) { var htmlFiles = OPTIONS . html ; tmpHTMLPaths = [ ] ; //check for file or files switch ( typeof htmlFiles ) { case 'object' : case 'array' : for ( i = 0 ; i < htmlFiles . length ; ++ i ) { getFilePaths ( htmlFiles [ i ] , [ '.html' , '.htm' ] ) ; } if ( tmpHTMLPaths . length ) { htmlFiles = tmpHTMLPaths ; } break ; case 'string' : //formats htmlFiles = htmlFiles . replace ( / / g , '' ) ; // comma delimited list - filename1.html, filename2.html if ( htmlFiles . indexOf ( ',' ) > - 1 ) { htmlFiles = htmlFiles . replace ( / ^\s+|\s+$ / g , '' ) . split ( ',' ) ; tmpStr = '' ; for ( i = 0 ; i < htmlFiles . length ; ++ i ) { getFilePaths ( htmlFiles [ i ] , [ '.html' , '.htm' ] ) ; } //end of for if ( tmpHTMLPaths . length ) { htmlFiles = tmpHTMLPaths ; } } else { //string path getFilePaths ( htmlFiles , [ '.html' , '.htm' ] ) ; if ( tmpHTMLPaths . length ) { htmlFiles = tmpHTMLPaths ; } } break ; } //end of switch htmlFileLocation = ( htmlFiles ) ? htmlFiles . toString ( ) : htmlFiles ; readHTMLFile ( htmlFiles ) ; CPEVENTS . on ( 'HTML_READ_AGAIN' , function ( ) { //process selectors processHTMLSelectors ( cssSelectors , htmlDataIn , htmlOptionsIn ) ; //read next file dataHTMLIn = [ ] ; readHTMLFile ( htmlFiles ) ; } ) ; CPEVENTS . on ( 'HTML_READ_END' , function ( ) { //process selectors processHTMLSelectors ( cssSelectors , htmlDataIn , htmlOptionsIn ) ; dataHTMLIn = [ ] ; CPEVENTS . emit ( 'HTML_RESULTS_END' , cssSelectors ) ; } ) ; } //end of html files check }
end of processHTMLSelectors
end of processHTMLSelectors