or run

npx @tessl/cli init
Log in

Version

Files

docs

index.md
tile.json

task.mdevals/scenario-2/

CSS Module Import Processor

A tool that processes CSS modules to handle both pre-existing :import() rules and composes declarations. The tool must recognize existing import rules and integrate them properly when transforming compose declarations.

Capabilities

Preserve existing imports

  • Given CSS with :import("./button.css") { btnClass: button; }, the processed output retains this exact import rule @test
  • Given CSS with two :import() rules (one from "./a.css" and one from "./b.css"), both import rules are present in the processed output @test

Handle composes with existing imports

  • Given CSS with an existing :import("./theme.css") { baseStyle: base; } and a .myClass { composes: baseStyle; } rule, the output contains the import rule and the composes reference unchanged @test

Implementation

@generates

API

/**
 * Processes CSS content containing :import() rules and composes declarations.
 * Preserves existing imports and transforms composes declarations into import rules.
 *
 * @param {string} cssContent - The CSS content to process
 * @returns {string} The transformed CSS with preserved and new import rules
 */
function processCssImports(cssContent) {
  // IMPLEMENTATION HERE
}

module.exports = { processCssImports };

Dependencies { .dependencies }

postcss-modules-extract-imports { .dependency }

Provides CSS Modules import extraction and transformation capabilities.

@satisfied-by