src/uncss.js
function getCSS([files, options, pages, stylesheets]) {
    /* Ignore specified stylesheets */
    if (options.ignoreSheets.length) {
        stylesheets = stylesheets
        .map((arr) => {
            return arr.filter((sheet) => {
                return _.every(options.ignoreSheets, (ignore) => {
                    if (_.isRegExp(ignore)) {
                        return !ignore.test(sheet);
                    }
                    return sheet !== ignore;
                });
            });
        });
    }

    if (_.flatten(stylesheets).length) {
        /* Only run this if we found links to stylesheets (there may be none...)
         *  files       = ['some_file.html', 'some_other_file.html']
         *  stylesheets = [['relative_css_path.css', ...],
         *                 ['maybe_a_duplicate.css', ...]]
         * We need to - make the stylesheets' paths relative to the HTML files,
         *            - flatten the array,
         *            - remove duplicates
         */
        stylesheets =
            _.chain(stylesheets)
                .map((sheets, i) => utility.parsePaths(files[i], sheets, options))
                .flatten()
                .uniq()
                .value();
    } else {
        /* Reset the array if we didn't find any link tags */
        stylesheets = [];
    }
    return Promise.all([options, pages, utility.readStylesheets(stylesheets, options.banner)]);
}
function getCSS([files, options, pages, stylesheets]) {
    /* Ignore specified stylesheets */
    if (options.ignoreSheets.length) {
        stylesheets = stylesheets
        .map((arr) => {
            return arr.filter((sheet) => {
                return _.every(options.ignoreSheets, (ignore) => {
                    if (_.isRegExp(ignore)) {
                        return !ignore.test(sheet);
                    }
                    return sheet !== ignore;
                });
            });
        });
    }

    if (_.flatten(stylesheets).length) {
        /* Only run this if we found links to stylesheets (there may be none...)
         *  files       = ['some_file.html', 'some_other_file.html']
         *  stylesheets = [['relative_css_path.css', ...],
         *                 ['maybe_a_duplicate.css', ...]]
         * We need to - make the stylesheets' paths relative to the HTML files,
         *            - flatten the array,
         *            - remove duplicates
         */
        stylesheets =
            _.chain(stylesheets)
                .map((sheets, i) => utility.parsePaths(files[i], sheets, options))
                .flatten()
                .uniq()
                .value();
    } else {
        /* Reset the array if we didn't find any link tags */
        stylesheets = [];
    }
    return Promise.all([options, pages, utility.readStylesheets(stylesheets, options.banner)]);
}
function getCSS ( [ files , options , pages , stylesheets ] ) { /* Ignore specified stylesheets */ if ( options . ignoreSheets . length ) { stylesheets = stylesheets . map ( ( arr ) => { return arr . filter ( ( sheet ) => { return _ . every ( options . ignoreSheets , ( ignore ) => { if ( _ . isRegExp ( ignore ) ) { return ! ignore . test ( sheet ) ; } return sheet !== ignore ; } ) ; } ) ; } ) ; } if ( _ . flatten ( stylesheets ) . length ) { /* Only run this if we found links to stylesheets (there may be none...)
         *  files       = ['some_file.html', 'some_other_file.html']
         *  stylesheets = [['relative_css_path.css', ...],
         *                 ['maybe_a_duplicate.css', ...]]
         * We need to - make the stylesheets' paths relative to the HTML files,
         *            - flatten the array,
         *            - remove duplicates
         */ stylesheets = _ . chain ( stylesheets ) . map ( ( sheets , i ) => utility . parsePaths ( files [ i ] , sheets , options ) ) . flatten ( ) . uniq ( ) . value ( ) ; } else { /* Reset the array if we didn't find any link tags */ stylesheets = [ ] ; } return Promise . all ( [ options , pages , utility . readStylesheets ( stylesheets , options . banner ) ] ) ; }
Get the contents of CSS files.
@param  {Array}   files       List of HTML files
@param  {Object}  options     UnCSS options
@param  {Array}   pages       Pages opened by jsdom
@param  {Array}   stylesheets List of CSS files
@return {Array}
Get the contents of CSS files .