Home > @lynx-js/template-webpack-plugin > LynxTemplatePlugin > convertCSSChunksToMap

LynxTemplatePlugin.convertCSSChunksToMap() method

Convert the css chunks to css map.

Signature:

static convertCSSChunksToMap(cssChunks: string[], plugins: CSS.Plugin[], enableCSSSelector: boolean): {
        cssMap: Record<string, CSS.LynxStyleNode[]>;
        cssSource: Record<string, string>;
    };

Parameters

ParameterTypeDescription
cssChunksstring[]The CSS chunks content.
pluginsCSS.Plugin[]
enableCSSSelectorboolean

Returns:

{ cssMap: Record<string, CSS.LynxStyleNode[]>; cssSource: Record<string, string>; }

The CSS map and css source.

Example

(console.log(await convertCSSChunksToMap(
  '.red { color: red; }',
  {
    targetSdkVersion: '3.2',
    enableCSSSelector: true,
  },
)));