Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function(phantomas) {
if (phantomas.getParam('analyze-css') !== true) {
phantomas.log('To enable CSS in-depth metrics please run phantomas with --analyze-css option');
return;
}
// load analyze-css module
// https://www.npmjs.com/package/analyze-css
const analyzer = require('analyze-css');
phantomas.log('Using version %s', analyzer.version);
phantomas.setMetric('cssParsingErrors'); // @desc number of CSS files (or embeded CSS) that failed to be parse by analyze-css @optional
phantomas.setMetric('cssInlineStyles'); // @desc number of inline styles @optional
function ucfirst(str) {
// http://kevin.vanzonneveld.net
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + improved by: Brett Zamir (http://brett-zamir.me)
// * example 1: ucfirst('kevin van zonneveld');
// * returns 1: 'Kevin van zonneveld'
str += '';
var f = str.charAt(0).toUpperCase();
return f + str.substr(1);
}