CSS alias copy automation
CSS alias copy automation keeps the package's compatibility stylesheet names aligned with the generated minified CSS output. It runs after minification and places two compatibility names under the published css/ paths, so consumers can use the established aliases without a separate build path.
Alias output
Compatibility aliases
The compatibility aliases are alternate public paths for the generated distribution stylesheet. The helper maps dist/index.min.css to both css/reseter.min.css and css/reseter.css. The two names therefore point to the same minified reset output rather than separate style variants.
References: scripts/copy-css-aliases.js• L6-15 package.json• L25-29
Published package role
The aliases are part of the package files exposed to consumers. The package includes both dist and css, so the copy step keeps the compatibility names present in the distribution that users install.
References: package.json• L25-29 scripts/copy-css-aliases.js• L6-9
Build flow
Post-minification copy stage
The copy stage runs as the postminify lifecycle step. The build first creates the minified full stylesheet, then minifies the smaller stylesheet, and finally invokes the alias helper. This ordering makes both aliases depend on the completed minified full stylesheet.
The flow from generated CSS to package aliases is:
flowchart LR
A[dist/index.min.css] --> C[copy-css-aliases.js]
C --> D[css/reseter.css]
C --> E[css/reseter.min.css]
References: package.json• L39-46 scripts/copy-css-aliases.js• L10-19
Directory readiness
The helper creates the package's css directory before it copies files. This lets a clean build produce the alias output without requiring the directory to exist first.
References: scripts/copy-css-aliases.js• L6-10
Related distribution pages
The parent page CSS distribution build describes the full build that produces the source-based CSS outputs. The sibling page CSS artifact publishing explains the checked-in artifacts that consumers load. This page narrows the view to the final name-alignment step that connects generated files to compatibility aliases.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep both alias source paths tied to dist/index.min.css. The smaller
minioutputs are not the sources for thereseteraliases. - Keep the
cssdirectory in the package file list when alias paths are changed. Otherwise the build can create aliases that are not included in the published package. - Keep the copy stage after CSS generation and minification. Earlier execution can copy missing or stale source files.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The source file in the alias map is missing | The copy stage fails and the build does not complete | Run the alias step after the full CSS generation and minification stages |
| An alias path changes without a matching package file entry | Consumers cannot install the compatibility file | Keep public alias paths aligned with the package files list |
The alias map points to a mini stylesheet | The compatibility name serves a reduced style set | Map both reseter aliases only to dist/index.min.css |
Key files
| File | Why to read it |
|---|---|
| scripts/copy-css-aliases.js | Defines the alias mapping and performs the final copies |
| package.json | Connects the helper to the build lifecycle and includes css in the published package |