postcss/postcss-devtools

Name: postcss-devtools

Owner: PostCSS

Description: Log execution time for each plugin in a PostCSS instance.

Created: 2016-01-28 17:40:07.0

Updated: 2018-05-07 21:46:24.0

Pushed: 2017-01-18 23:10:27.0

Homepage: null

Size: 24

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

postcss-devtools Build Status NPM version

Log execution time for each plugin in a PostCSS instance.

Install

With npm do:

install postcss-devtools --save-dev
Example

Load postcss-devtools into a PostCSS instance and it will wrap each plugin with a function that logs the time taken for the plugin to perform its required task. Note that this plugin must be used with the asynchronous API:

postcss = require('postcss');
devtools = require('postcss-devtools');
autoprefixer = require('autoprefixer');

css = 'h1 { color: red }';

css([devtools(), autoprefixer()]).process(css).then(function (result) {
console.log('Done.');


 autoprefixer  37 ms
 Done.
API
devtools([options])
options precise

Type: boolean
Default: false

This adds extra precision to the times that are reported.

silent

Type: boolean
Default: false

Set this to true to use your own logger for the output of this module.

devtools.printSummary()

Print a summary spanning across all files. Note that you should set opts.silent to true to avoid outputting more than is necessary when calling this function.

postcss = require('postcss');
devtools = require('postcss-devtools')({silent: true}); // disable summary for each css file
autoprefixer = require('autoprefixer');

cssOne = 'h1 { color: red }';
cssTwo = 'h1 { color: blue }';
iew a summary for all plugins across all css files
ise.all(

postcss([devtools, autoprefixer()]).process(cssOne),
postcss([devtools, autoprefixer()]).process(cssTwo)

en(() => {
nsole.log('Done.');
vtools.printSummary();

 Done.
 Summary
 autoprefixer  73 ms
Usage

See the PostCSS documentation for examples for your environment.

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

License

MIT © Ben Briggs


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.