Skip to content

Commit 8e88555

Browse files
committed
fix: restructure css files to match rollup config (postcss)
1 parent cf3dbdb commit 8e88555

10 files changed

+355
-283
lines changed

package-lock.json

+331-267
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
},
5252
"devDependencies": {
5353
"@rollup/plugin-commonjs": "^11.1.0",
54-
"@rollup/plugin-node-resolve": "^13.0.0",
54+
"@rollup/plugin-node-resolve": "^13.3.0",
5555
"@rollup/plugin-typescript": "^8.2.1",
5656
"@semantic-release/changelog": "^5.0.1",
5757
"@semantic-release/commit-analyzer": "^8.0.1",

rollup.config.js

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1+
/* eslint-disable import/no-anonymous-default-export */
12
import resolve from "@rollup/plugin-node-resolve";
23
import peerDepsExternal from "rollup-plugin-peer-deps-external";
34
import typescript from "@rollup/plugin-typescript";
45
import del from "rollup-plugin-delete";
56
import svgr from "@svgr/rollup";
67
import commonjs from "@rollup/plugin-commonjs";
78
import postcss from "rollup-plugin-postcss";
9+
import { nodeResolve } from "@rollup/plugin-node-resolve";
810
import { eslint } from "rollup-plugin-eslint";
911
import autoprefixer from "autoprefixer";
12+
import path from 'path'
1013

1114
export default [
1215
// CommonJS
1316
{
1417
input: "src/index.tsx",
18+
external: ["./lib/style.css", "lodash"],
1519
output: {
1620
dir: "./",
1721
entryFileNames: "lib/cjs/index.js",
@@ -30,7 +34,11 @@ export default [
3034
noEmit: true
3135
}),
3236
peerDepsExternal(),
33-
resolve(),
37+
resolve({
38+
jsnext: true,
39+
main: true,
40+
browser: true,
41+
}),
3442
svgr(),
3543
commonjs({
3644
include: "node_modules/**",
@@ -40,20 +48,19 @@ export default [
4048
}
4149
}),
4250
postcss({
43-
extensions: [".css"],
51+
extensions: ['.css'],
52+
extract: path.resolve("lib/style.css"),
53+
modules: true,
4454
plugins: [autoprefixer()],
45-
sourceMap: true,
46-
extract: true,
47-
minimize: true
55+
}),
56+
nodeResolve({
57+
extensions: ['.css']
4858
}),
4959
eslint({
5060
exclude: [
51-
"src/map/map.css",
52-
"src/controls/controls.css",
53-
"src/controls/controls.css",
61+
"src/styles/*.css"
5462
]
55-
}),
56-
],
57-
external: ["lodash"]
63+
})
64+
]
5865
},
5966
];

src/controls/controls.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { FC, useContext, useState } from "react";
22
import ReactDOM from "react-dom";
33
import { MapContext } from "../map";
4-
import "./controls.css";
4+
import "../styles/controls.css";
55

66
export const MapControls: FC<{ templateGridStyle: React.CSSProperties }> = ({
77
children,

src/controls/full-screen-control.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { FC, useContext, useEffect, useState } from "react";
22
import { FullScreen } from "ol/control";
33
import { Map } from "ol";
44
import { MapContext } from "../map/map-context";
5-
import "./control.css";
5+
import "../styles/control.css";
66

77
import screenfull from "screenfull";
88

src/map/map.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React, {
55
FunctionComponent,
66
MutableRefObject,
77
} from "react";
8-
import "./map.css";
8+
import "../styles/map.css";
99
import { MapContext } from "./map-context";
1010
import * as ol from "ol";
1111
import { useEvent } from "../events/use-event";
File renamed without changes.
File renamed without changes.
File renamed without changes.

tsconfig.lib.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
],
1414
"include": [
1515
"src/**/*.ts",
16-
"src/**/*.tsx"
16+
"src/**/*.tsx",
17+
"src/**/*.css"
1718
]
1819
}

0 commit comments

Comments
 (0)