Skip to content

Commit f0167be

Browse files
committed
breakpoints in coordination with framework's
1 parent cfc5867 commit f0167be

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/rollup.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ export async function bundleStyles({
6262
// dirty patch for tailwind: remove margin:0 and styles resets for headers
6363
// etc. It should probably be a tailwind plugin instead.
6464
if (path === getClientPath("tailwind.css"))
65-
text = text.replaceAll(/}[^{]*h1,\n*h2,\n*h3,\n*h4,\n*h5,\n*h6[^}]+}\s*/g, "}");
65+
text = text
66+
.replaceAll(/}[^{]*h1,\n*h2,\n*h3,\n*h4,\n*h5,\n*h6[^}]+}\s*/g, "}")
67+
.replace(/}[^{]*body[^}]+}\s*/, "}")
68+
.replace(/box-sizing:\s*border-box;/, "");
6669

6770
return text;
6871
}
@@ -212,7 +215,8 @@ async function tailwindConfig(root: string): Promise<ESBuildPlugin> {
212215
configPath,
213216
`
214217
// File generated by rollup.ts; to configure tailwind, edit ${root}/tailwind.config.js
215-
${s ? `import config from "../../${twconfig}"` : "const config = {}"};
218+
${s ? `import cfg from "../../${twconfig}"` : "const cfg = {}"};
219+
const {theme, ...config} = cfg ?? {};
216220
export default {
217221
content: {
218222
files: [
@@ -224,6 +228,15 @@ export default {
224228
darkMode: ["variant", "&:where([class~=dark], [class~=dark] *)"],
225229
blocklist: ["grid", "grid-cols-2", "grid-cols-3", "grid-cols-4"],
226230
prefix: "",
231+
theme: {
232+
screens: {
233+
sm: "640px",
234+
md: "768px",
235+
lg: "calc(640px + 5rem + 192px)",
236+
xl: "calc(640px + 7rem + 272px + 192px)"
237+
},
238+
...theme
239+
},
227240
...config
228241
};
229242
`

0 commit comments

Comments
 (0)