Skip to content

Support clientlib metadata generation for dynamically created CSS files #126

Description

@Hugoer

Currently, the NC FE Build system only generates .content.xml and {css|js}.txt files for source files with .js or .scss extensions. However, when using PostCSS plugins, new CSS files may be generated at build time (e.g., clientlibs with dynamic output). These new files are not currently included in the clientlib metadata, which prevents them from being accessible in AEM environments.

This feature request proposes extending the build configuration to support metadata generation based on output (target) files, specifically for dynamically created CSS files.

Proposed Configuration Extension:
A new extraEntries object can be added to the PostCSS config:

extraEntries: {
  extension: 'css',
  cwd: destinationPath,
  filenamePattern: 'clientlibs2-*',
}

Key Requirements:
Generate corresponding .content.xml and .css.txt files for dynamically created CSS files.

Avoid duplicate generation for files that are already covered by the source-based mechanism.

Prevent redundant entries like:

{
  "sass/clientlibs/dtcomponents/appstorebuttons/appstorebuttons.clientlibs2.scss": "/path/to/src/appstorebuttons.clientlibs2.scss",
  "sass/clientlibs/dtcomponents/appstorebuttons/appstorebuttons.clientlibs2.css": "/path/to/target/appstorebuttons.clientlibs2.css"
}

This change ensures proper inclusion of dynamically generated assets in the clientlibs structure without impacting build performance (as much as possible).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions