Home > @lynx-js/template-webpack-plugin > LynxEncodePlugin > encodeCSS

LynxEncodePlugin.encodeCSS() method

Encode CSS chunks into a template.

Signature:

static encodeCSS(cssChunks: string[], options: EncodeCSSOptions, plugins?: CSS.Plugin[], encode?: (options: any) => Promise<{
        buffer: Buffer;
    }>): Promise<Buffer>;

Parameters

ParameterTypeDescription
cssChunksstring[]The CSS chunks' content.
optionsEncodeCSSOptionsThe encode options.
pluginsCSS.Plugin[](Optional)
encode(options: any) => Promise<{ buffer: Buffer; }>(Optional)

Returns:

Promise<Buffer>

The buffer of the template.

Example

(await encodeCSS(
  '.red { color: red; }',
  {
    targetSdkVersion: '3.2',
    enableCSSSelector: true,
  },
)).toString('base64'),