Constructor
new LazyResult()
- Source:
Example
const lazy = postcss([cssnext]).process(css)
Members
content :string
- Source:
- See:
An alias for the css property. Use it with syntaxes
that generate non-CSS output.
This property will only work with synchronous plugins. If the processor contains any asynchronous plugins it will throw an error. This is why this method is only for debug purpose, you should always use LazyResult#then.
Type:
- string
css :string
- Source:
- See:
Processes input CSS through synchronous plugins, converts Root
to a CSS string and returns Result#css.
This property will only work with synchronous plugins. If the processor contains any asynchronous plugins it will throw an error. This is why this method is only for debug purpose, you should always use LazyResult#then.
Type:
- string
map :SourceMapGenerator
- Source:
- See:
Processes input CSS through synchronous plugins and returns Result#map.
This property will only work with synchronous plugins. If the processor contains any asynchronous plugins it will throw an error. This is why this method is only for debug purpose, you should always use LazyResult#then.
Type:
- SourceMapGenerator
messages :Array.<Message>
- Source:
- See:
Processes input CSS through synchronous plugins and returns Result#messages.
This property will only work with synchronous plugins. If the processor contains any asynchronous plugins it will throw an error.
This is why this method is only for debug purpose, you should always use LazyResult#then.
Type:
- Array.<Message>
opts :processOptions
- Source:
Options from the Processor#process call.
Type:
processor :Processor
- Source:
Returns a Processor instance, which will be used for CSS transformations.
Type:
root :Root
- Source:
- See:
Processes input CSS through synchronous plugins and returns Result#root.
This property will only work with synchronous plugins. If the processor contains any asynchronous plugins it will throw an error.
This is why this method is only for debug purpose, you should always use LazyResult#then.
Type:
Methods
catch(onRejected) → {Promise}
- Source:
Processes input CSS through synchronous and asynchronous plugins and calls onRejected for each error thrown in any plugin.
It implements standard Promise API.
Example
postcss([cssnext]).process(css).then(result => {
console.log(result.css)
}).catch(error => {
console.error(error)
})
Parameters:
| Name | Type | Description |
|---|---|---|
onRejected |
onRejected | Callback will be executed on any error. |
Returns:
Promise API to make queue.
- Type
- Promise
finally(onFinally) → {Promise}
- Source:
Processes input CSS through synchronous and asynchronous plugins and calls onFinally on any error or when all plugins will finish work.
It implements standard Promise API.
Example
postcss([cssnext]).process(css).finally(() => {
console.log('processing ended')
})
Parameters:
| Name | Type | Description |
|---|---|---|
onFinally |
onFinally | Callback will be executed on any error or when all plugins will finish work. |
Returns:
Promise API to make queue.
- Type
- Promise
then(onFulfilled, onRejected) → {Promise}
- Source:
Processes input CSS through synchronous and asynchronous plugins
and calls onFulfilled with a Result instance. If a plugin throws
an error, the onRejected callback will be executed.
It implements standard Promise API.
Example
postcss([cssnext]).process(css, { from: cssPath }).then(result => {
console.log(result.css)
})
Parameters:
| Name | Type | Description |
|---|---|---|
onFulfilled |
onFulfilled | Callback will be executed when all plugins will finish work. |
onRejected |
onRejected | Callback will be executed on any error. |
Returns:
Promise API to make queue.
- Type
- Promise
toString() → {string}
- Source:
Alias for the LazyResult#css property.
Example
lazy + '' === lazy.css
Returns:
Output CSS.
- Type
- string
warnings() → {Array.<Warning>}
- Source:
Processes input CSS through synchronous plugins and calls Result#warnings().
Returns:
Warnings from plugins.
- Type
- Array.<Warning>