Processor used for this transformation.
Root node after all transformations.
Options from the Processor#process
or Root#toResult
.
A CSS string representing of Result#root
.
postcss.parse('a{}').toResult().css //=> "a{}"
Last runned PostCSS plugin.
An instance of SourceMapGenerator
class from the source-map
library,
representing changes to the Result#root
instance.
result.map.toJSON() //=> { version: 3, file: 'a.css', … }
if (result.map) {
fs.writeFileSync(result.opts.to + '.map', result.map.toString())
}
Contains messages from plugins (e.g., warnings or custom messages). Each message should have type and plugin properties.
AtRule: {
import: (atRule, { result }) {
const importedFile = parseImport(atRule)
result.messages.push({
type: 'dependency',
plugin: 'postcss-import',
file: importedFile,
parent: result.opts.from
})
}
}
Options from the Processor#process
or Root#toResult
call
that produced this Result instance.]
root.toResult(opts).opts === opts
The Processor instance used for this transformation.
for (const plugin of result.processor.plugins) {
if (plugin.postcssPlugin === 'postcss-bad') {
throw 'postcss-good is incompatible with postcss-bad'
}
})
Root node after all transformations.
root.toResult().root === root
An alias for the Result#css
property.
Use it with syntaxes that generate non-CSS output.
result.css === result.content
Returns for Result#css
content.
result + '' === result.css
String representing of Result#root
.
Creates an instance of Warning
and adds it to Result#messages
.
if (decl.important) {
result.warn('Avoid !important', { node: decl, word: '!important' })
}
Created warning.
Returns warnings from plugins. Filters Warning
instances
from Result#messages
.
result.warnings().forEach(warn => {
console.warn(warn.toString())
})
Warnings from plugins.
Provides the result of the PostCSS transformations.
A Result instance is returned by
LazyResult#then
orRoot#toResult
methods.