Skip to content

Commit

Permalink
Configure css imports in JS files
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-va committed Dec 3, 2024
1 parent 04677b1 commit b13506b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
18 changes: 18 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"source-map-loader": "5.0.0",
"start-server-and-test": "2.0.8",
"stream-to-promise": "3.0.0",
"style-loader": "^4.0.0",
"ts-loader": "9.5.1",
"ts-node": "10.9.2",
"typescript": "5.6.3",
Expand Down
32 changes: 20 additions & 12 deletions ui/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ const cesiumSource = 'node_modules/cesium/Source';
const cesiumWorkers = '../Build/Cesium/Workers';
const extensions = ['.ts', '.js'];

const postcssPlugins = [
inlinesvg(),
cssimport({
plugins: [
postcssurl([
{filter: '**/*.+(woff|woff2)', url: (asset) => `fonts/${path.basename(asset.url)}`},
])
]
}),
autoprefixer()
];

const config = {
input: 'src/index.ts',
output: [{
Expand All @@ -27,18 +39,14 @@ const config = {
postcss({
minimize: true,
inject: false,
extract: 'index.css',
plugins: [
inlinesvg(),
cssimport({
plugins: [
postcssurl([
{filter: '**/*.+(woff|woff2)', url: (asset) => `fonts/${path.basename(asset.url)}`},
])
]
}),
autoprefixer()
]
extract: false,
plugins: postcssPlugins,
}),
postcss({
minimize: true,
inject: false,
extract: '**/style/index.css',
plugins: postcssPlugins,
}),
json(),
resolve({
Expand Down
6 changes: 6 additions & 0 deletions ui/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ const config = {
},
{
test: /\.css$/i,
issuer: /\.(?:js|ts)$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.css$/i,
issuer: {not: [/\.(?:js|ts)$/]},
//use: [isDev ? "style-loader" : MiniCssExtractPlugin.loader, 'css-loader'],
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
Expand Down

0 comments on commit b13506b

Please sign in to comment.