Package Exports
- postcss-regexp-detect
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-regexp-detect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
postcss-regexp-detect
PostCSS plugin to search for regexp in rule declaraions
##Purpose This plugin was initially created to analyse css compiled by stylus and find unresolved variables.
When stylus can't resolve a variable, it inserts string with its name and doesn't throw any warning. To avoid such surprises we developed this warning plugin.
Usage
This plugin writes all warnings to postcss result.messages. You'll need some tool
to handle them. You can process them manually, or use some plugin for output. for example, postcss-reporter.
// dependencies
var fs = require("fs")
var postcss = require("postcss")
var regexp = require("postcss-regexp")
var reporter = require('postcss-reporter');
// css to be processed
var css = fs.readFileSync("input.css", "utf8")
// process css
var output = postcss()
.use(regexp({
regexp: new RegExp('.+px'),
messagePattern: 'Pixel value %s found on line %l'
}))
.use(reporter)
.process(css, {
from: "src/stylesheet/index.css"
to: "dist/index.css"
})
.cssOptions
regexp (required)
Type: String or RegExp
Regexp to match
messagePattern (optional)
Type: String
Default: Regexp matched with %s on line %l
Pattern for message text.
- %s is for matched strings
- %l is for line number
- %f is for postcss from parameter