-
Notifications
You must be signed in to change notification settings - Fork 8
fix: add missing static css files for WC #1385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
4fa2192
2879050
d07187d
9846fab
ac7d422
e47ce76
98fa21e
d515d38
2c07420
60b519e
695d11b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,18 @@ | ||
| import { defineConfig } from 'vite'; | ||
| import { VitePWA } from 'vite-plugin-pwa'; | ||
| import { viteStaticCopy } from 'vite-plugin-static-copy'; | ||
| import fs from 'fs'; | ||
| import path from 'path'; | ||
|
|
||
| const themeColors = ["light", "dark"]; | ||
| const themeTypes = ["material", "bootstrap", "indigo", "fluent"]; | ||
| const basePaths = [ | ||
| "node_modules/igniteui-webcomponents-grids/grids/themes", | ||
| "node_modules/@infragistics/igniteui-webcomponents-grids/grids/themes" | ||
| ]; | ||
| const themeFiles = themeColors.flatMap(color => | ||
| themeTypes.flatMap(theme => basePaths.map(basePath => `${basePath}/${color}/${theme}.css`)) | ||
| ).filter(fs.existsSync); | ||
|
|
||
| export default defineConfig({ | ||
| build: { | ||
|
|
@@ -21,10 +33,22 @@ export default defineConfig({ | |
| chunkSizeWarningLimit: 10 * 1024 * 1024 // 10 MB | ||
| }, | ||
| plugins: [ | ||
| { | ||
| name: 'replace-grid-css-paths', | ||
| apply: 'build', | ||
| transform(code, id) { | ||
| if (id.endsWith('.js')) { | ||
| themeFiles.forEach(t => { code = code.replaceAll(t, `../../${path.basename(t)}`); }); | ||
| return code; | ||
| } | ||
| } | ||
| }, | ||
| /** Copy static assets */ | ||
| viteStaticCopy({ | ||
| targets: [ | ||
| { src: 'src/assets', dest: 'src' }, | ||
| { src: 'ig-theme.css', dest: '' }, | ||
|
||
| ...themeFiles.map(themePath => ({ src: themePath, dest: '' })) | ||
| ], | ||
| silent: true, | ||
| }), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, nope :)
If the idea is to build out functionality to copy all themes in general, just copy them all - at best what you can do is hardcode the path, not the specific variants (material, etc, those can and will change).
Should be fine to just copy the entire
node_modules/igniteui-webcomponents-gridstheme folder and it'd do the same thing as this, right? Surely the static copy plugin can work with globsAlso, not sure why restricted to
igniteui-webcomponents-gridsas well, should includeigniteui-webcomponents's themes too, no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we generally keep the package licensed maps separately so this could also work with one version of the packages and swap the node_modules path with the upgrade command. We don't put path maps in tsconfig for dual package support, so that will make it somewhat consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes are no longer needed, we will include these css files by importing them not by link tag.