LazyResult

LazyResult

A Promise proxy for the result of PostCSS transformations.

A LazyResult instance is returned by Processor#process.

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:

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

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).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>