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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Log execution time for each plugin in a PostCSS instance.
With npm do:
install postcss-devtools --save-dev
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.
Type: boolean
Default: false
This adds extra precision to the times that are reported.
Type: boolean
Default: false
Set this to true
to use your own logger for the output of this module.
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
See the PostCSS documentation for examples for your environment.
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs