Skip to content

Commit df3b7c7

Browse files
committed
Prune orphaned CSS artifacts before building
Renamed or removed components left behind generated .css files with no .pcss source (e.g. open_project/skeleton_box, open_project/tree_view). export-css-selectors globbed all .css and mapped the stale selectors into static/classes.json, leaving the working tree dirty after a build. Adds a prune step at the start of build_css that deletes the generated .css/.css.map/.css.json artifacts before regenerating from the current .pcss sources. All such artifacts are gitignored and regenerable.
1 parent 132bcdf commit df3b7c7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

script/build-assets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
export INPUT_TYPE=$1
44

55
build_css() {
6+
# Remove previously generated CSS artifacts so components that were renamed or
7+
# removed don't leave orphaned files behind. Stale .css would otherwise be
8+
# picked up by export-css-selectors and pollute static/classes.json.
9+
find app/components/primer \( -name '*.css' -o -name '*.css.map' -o -name '*.css.json' \) -delete
10+
611
# Get a list of all the CSS files in the src directory
712
CSS_FILES=$(find app/components/primer -name '*.pcss' ! -path '*/primer.pcss')
813
npx postcss $CSS_FILES --dir app/components --base app/components --ext css && \

0 commit comments

Comments
 (0)