How to use analyze-css - 1 common examples

To help you get started, we’ve selected a few analyze-css examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github macbre / phantomas / modules / analyzeCss / analyzeCss.js View on Github external
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);
	}

analyze-css

CSS selectors complexity and performance analyzer

BSD-2-Clause
Latest version published 1 day ago

Package Health Score

72 / 100
Full package analysis

Popular analyze-css functions