File tree Expand file tree Collapse file tree 4 files changed +45
-47
lines changed
Expand file tree Collapse file tree 4 files changed +45
-47
lines changed Original file line number Diff line number Diff line change 11node_modules
22* .js
33! web-test-runner.config.js
4- ! css-to-ts.js
54! commitlint.config.js
65* .css
76* -styles.ts
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3939 " **/*.js.map" ,
4040 " **/*.d.ts" ,
4141 " **/*.scss" ,
42- " !css-to-ts.js" ,
4342 " !web-test-runner.config.js" ,
4443 " !commitlint.config.js" ,
4544 " !**/test/**" ,
4645 " !**/*_test.*" ,
4746 " !.wireit/**" ,
48- " !catalog" ,
47+ " !catalog/ " ,
4948 " !scripts/" ,
5049 " !**/testing/**" ,
5150 " testing/harness.{js,js.map,d.ts}" ,
8786 " **/*.ts" ,
8887 " !**/*.d.ts" ,
8988 " !**/*-styles.ts" ,
90- " !catalog" ,
91- " !scripts/" ,
92- " !node_modules"
89+ " !catalog/" ,
90+ " !scripts/"
9391 ],
9492 "output" : [
9593 " .tsbuildinfo" ,
9694 " **/*.js" ,
9795 " **/*.js.map" ,
9896 " **/*.d.ts" ,
99- " !css-to-ts.js" ,
10097 " !web-test-runner.config.js" ,
10198 " !commitlint.config.js" ,
10299 " !types/" ,
103- " !catalog" ,
100+ " !catalog/ " ,
104101 " !scripts/"
105102 ],
106103 "clean" : " if-file-deleted" ,
109106 ]
110107 },
111108 "build:css-to-ts" : {
112- "command" : " find . \\ ( -path ./.wireit -o -path ./node_modules -o -path ./catalog \\ ) -prune -o -name '*-styles.css' -print | xargs node css-to-ts.js" ,
109+ "command" : " find . \\ ( -path ./.wireit -o -path ./node_modules -o -path ./catalog \\ ) -prune -o -name '*-styles.css' -print | xargs -L1 node scripts/ css-to-ts.js" ,
113110 "files" : [
114- " css-to-ts.js" ,
115- " !scripts/" ,
116- " !node_modules"
111+ " **/*-styles.css" ,
112+ " !catalog/"
117113 ],
118114 "output" : [
119115 " **/*-styles.ts" ,
120- " !catalog" ,
121- " !scripts/"
116+ " !catalog/"
122117 ],
123118 "dependencies" : [
119+ " build:scripts" ,
124120 " build:sass"
125121 ]
126122 },
127123 "build:sass" : {
128124 "command" : " sass --style=compressed --load-path=node_modules --load-path=node_modules/sass-true/sass $(ls -d */ | grep -vE 'node_modules|catalog')" ,
129125 "files" : [
130126 " **/*.scss" ,
131- " !catalog" ,
132- " !scripts/" ,
133- " !node_modules"
127+ " !catalog/"
134128 ],
135129 "output" : [
136130 " **/*.css" ,
137131 " **/*.css.map" ,
138- " !catalog" ,
139- " !scripts/"
132+ " !catalog/"
140133 ]
141134 },
142135 "test" : {
177170 " **/*.ts" ,
178171 " !**/*.d.ts" ,
179172 " !**/*-styles.ts" ,
180- " !catalog" ,
173+ " !catalog/ " ,
181174 " !scripts/" ,
182- " scripts/analyzer/update-docs.js" ,
183- " !node_modules"
175+ " scripts/analyzer/update-docs.js"
184176 ],
185177 "output" : [],
186178 "dependencies" : [
Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * Copyright 2022 Google LLC
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ import * as fs from 'fs' ;
8+
9+ const cssFilePath = process . argv [ 2 ] ;
10+ if ( ! cssFilePath ) {
11+ throw new Error ( `Usage: node scripts/css-to-ts.js <input.css> [output.ts]` ) ;
12+ }
13+
14+ const tsFilePath = process . argv [ 3 ] || cssFilePath . replace ( '.css' , '.ts' ) ;
15+ const cssContent = fs
16+ . readFileSync ( cssFilePath , { encoding : 'utf8' } )
17+ // Remove source map comments since the css is embedded.
18+ // "/*# sourceMappingURL=checkbox-styles.css.map */"
19+ . replace ( / \/ \* # \ s o u r c e M a p p i n g U R L = [ ^ \* ] + \* \/ / , '' ) ;
20+
21+ fs . writeFileSync (
22+ tsFilePath ,
23+ `/**
24+ * @license
25+ * Copyright 2024 Google LLC
26+ * SPDX-License-Identifier: Apache-2.0
27+ */
28+ // Generated stylesheet for ${ cssFilePath } .
29+ import {css} from 'lit';
30+ export const styles = css\`${ cssContent } \`;
31+ ` ,
32+ ) ;
You can’t perform that action at this time.
0 commit comments