Skip to content

PavelDemyanenko/gulp-parker

Repository files navigation

gulp-parker Build Status

NPM version Dependency Status NPM downloads MIT License

Gulp plugin for parker, a stylesheet analysis tool.

  • Took code, ideas from @leny and made it work with Gulp.

Getting Started

This plugin requires Gulp 3.9.1

If you haven't used Gulp before, be sure to check out the Getting Started. Once you're familiar with that process, you may install this plugin with this command:

npm install gulp-parker --save-dev

The "parker" task

Overview

In your project's Gulpfile, add a task named parker.

gulp.task('parker', function() {
	return gulp.src('./test.css')
		.pipe(parker());
});

Options

options.metrics

Type: Array (metric names)
Default value: false

An array of the metrics to use in parker.
By default, gulp-parker use all available metrics.

By now, gulp-parker accepts the following metrics :

  • TotalStylesheets
  • TotalStylesheetSize
  • TotalRules
  • TotalSelectors
  • TotalIdentifiers
  • TotalDeclarations
  • SelectorsPerRule
  • IdentifiersPerSelector
  • SpecificityPerSelector
  • TopSelectorSpecificity
  • TopSelectorSpecificitySelector
  • TotalIdSelectors
  • TotalUniqueColours
  • UniqueColours
  • TotalImportantKeywords
  • TotalMediaQueries
  • MediaQueries

options.file

Type: String (file path)
Default value: false

A file path to log the reported results, in markdown format.
If false is given, the file will not be written.

options.title

Type: String
Default value: Gulp Parker Report

When logging the reported results to file, use this as title of the markdown document.

Usage Examples

Default Options

In this example, the default options are used to shows the results of the parker analysis for the given files.

gulp.task('parker', function() {
	return gulp.src('./*.css')
		.pipe(parker());
});

Custom Options

In this example, custom options are used to shows the results of the parker analysis for the given files, with only the four given metrics, and write the results on a file named report.md

gulp.task('parker', function() {
	return gulp.src('./*.css')
		.pipe(parker({
			file: 'report.md',
			title: 'Gulp test report',
			metrics: [
				"TotalRules",
				"TotalStylesheets"
			]}));
});

Contributing

Lint and test your code using Gulp.

Release History

  • 2015/02/20 : v0.1.0

  • 2018/04/27 : v0.1.6 Update Parker; Replace result file, not append; Remove logging

About

📊 Gulp plugin for Parker, a stylesheet analysis tool

Resources

License

Stars

Watchers

Forks

Packages

No packages published