Skip to content

Commit f0cb8f8

Browse files
authored
fix: use Tailwind CLI to trigger esbuild for JIT mode
This needs some additional cleanup.
1 parent 12c0857 commit f0cb8f8

12 files changed

+222
-193
lines changed

.gitignore

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Bridgetown
2+
build
23
output
34
.bridgetown-cache
45
.bridgetown-metadata
@@ -34,10 +35,5 @@ yarn-debug.log*
3435
# Yarn Integrity file
3536
.yarn-integrity
3637

37-
# Added
38-
.bridgetown-build
39-
.obsidian
40-
src/templates
41-
38+
# Vercel
4239
.vercel
43-
build

Rakefile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ task default: :deploy
99
# Standard set of tasks, which you can customize if you wish:
1010
#
1111
desc "Build the Bridgetown site for deployment"
12-
task deploy: [:clean, "frontend:build"] do
12+
task deploy: [:clean, "tailwind:build", "frontend:build"] do
1313
Bridgetown::Commands::Build.start
1414
end
1515

@@ -28,13 +28,34 @@ namespace :frontend do
2828
desc "Build the frontend with esbuild for deployment"
2929
task :build do
3030
ENV["BRIDGETOWN_ENV"] = "production"
31+
32+
Rake::Task["tailwind:build"].execute
3133
sh "yarn run esbuild"
3234
end
3335

3436
desc "Watch the frontend with esbuild during development"
3537
task :dev do
3638
ENV["BRIDGETOWN_ENV"] = "development"
39+
server_pid = fork { Rake::Task["tailwind:dev"].execute }
3740
sh "yarn run esbuild-dev"
41+
Process.kill "SIGTERM", server_pid
42+
sleep 1 # give processes time to clean up
43+
puts
44+
rescue Interrupt
45+
end
46+
end
47+
48+
namespace :tailwind do
49+
desc "Build the CSS with Tailwind"
50+
task :build do
51+
ENV["NODE_ENV"] = "production"
52+
sh "yarn tailwindcss -i ./frontend/styles/main.css -o ./frontend/styles/index.css --minify"
53+
end
54+
55+
desc "Watch the frontend with esbuild during development"
56+
task :dev do
57+
ENV["NODE_ENV"] = "development"
58+
sh "yarn tailwindcss -i ./frontend/styles/main.css -o ./frontend/styles/index.css --watch"
3859
rescue Interrupt
3960
end
4061
end

bridgetown.config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ permalink: simple
88
content_engine: resource
99

1010
collections:
11-
newsletter:
12-
output: true
13-
permalink: "/:slug/"
1411
pages:
1512
permalink: "/:slug/"
1613
posts:

config/esbuild.defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// when an update is applied hence we strongly recommend adding overrides to
77
// `esbuild.config.js` instead of editing this file.
88
//
9-
// Shipped with Bridgetown v1.0.0.beta1
9+
// Shipped with Bridgetown v1.0.0.beta2
1010

1111
const path = require("path")
1212
const fsLib = require("fs")

esbuild.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,17 @@ build(outputFolder, esbuildOptions)
2424
// })
2525
// // watcher.close()
2626
// }
27+
28+
// const path = require("path")
29+
// const esbuildCopy = require('esbuild-plugin-copy').default
30+
// const esbuildOptions = {
31+
// plugins: [
32+
// esbuildCopy({
33+
// assets: {
34+
// from: [path.resolve(__dirname, 'node_modules/somepackage/files/*')],
35+
// to: [path.resolve(__dirname, 'output/_bridgetown/somepackage/files')],
36+
// },
37+
// verbose: false
38+
// }),
39+
// ]
40+
// }

frontend/styles/index.css

Lines changed: 1 addition & 174 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/styles/main.css

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;
4+
5+
@layer base {
6+
@font-face {
7+
font-family: "IBM Plex Sans";
8+
font-style: normal;
9+
font-weight: 100 900;
10+
font-display: optional;
11+
src: url(../fonts/ibm-plex-sans-var.woff2) format("woff2");
12+
}
13+
14+
@font-face {
15+
font-family: "IBM Plex Sans";
16+
font-style: italic;
17+
font-weight: 100 900;
18+
font-display: optional;
19+
src: url(../fonts/ibm-plex-sans-var-italic.woff2) format("woff2");
20+
}
21+
22+
:root {
23+
--primary: #007aff;
24+
--primary-light: #298fff;
25+
--primary-dark: #0066d6;
26+
--page: #fafafa;
27+
--code: #262626;
28+
--text-code: #f5f5f5;
29+
--page-inverted: #171717;
30+
--text: #262626;
31+
--text-muted: #525252;
32+
--text-inverted: #fafafa;
33+
--divider: #d4d4d4;
34+
--nav-bg: #f5f5f5;
35+
}
36+
37+
.dark {
38+
--primary: #ec4899;
39+
--primary-light: #fb7185;
40+
--primary-dark: #db2777;
41+
--page: #171717;
42+
--code: #262626;
43+
--text-code: #fafafa;
44+
--page-inverted: #fafafa;
45+
--text: #e5e7eb;
46+
--text-muted: #a3a3a3;
47+
--divider: #404040;
48+
--nav-bg: #262626;
49+
}
50+
51+
.highlight code .k {
52+
color: #d55fde;
53+
}
54+
.highlight code .c,
55+
.highlight code .err,
56+
.highlight code .l,
57+
.highlight code .g,
58+
.highlight code .o,
59+
.highlight code .x,
60+
.highlight code .p,
61+
.highlight code .ch,
62+
.highlight code .cm,
63+
.highlight code .cpf,
64+
.highlight code .c1,
65+
.highlight code .cs,
66+
.highlight code .nn,
67+
.highlight code .ni,
68+
.highlight code .ne,
69+
.highlight code .ld,
70+
.highlight code .nx,
71+
.highlight code .py,
72+
.highlight code .gt,
73+
.highlight code .gp,
74+
.highlight code .w,
75+
.highlight code .gs,
76+
.highlight code .gr {
77+
color: #aab1c0;
78+
}
79+
.highlight code .ge {
80+
color: #aab1c0;
81+
text-decoration: underline;
82+
}
83+
.highlight code .go {
84+
color: #44475a;
85+
}
86+
.highlight code .gh,
87+
.highlight code .gu {
88+
color: #aab1c0;
89+
font-weight: bold;
90+
}
91+
92+
.highlight code .kd {
93+
color: #8be9fd;
94+
font-style: italic;
95+
}
96+
.highlight code .kc,
97+
.highlight code .cp,
98+
.highlight code .kn,
99+
.highlight code .kp,
100+
.highlight code .kr,
101+
.highlight code .kt {
102+
color: #d55fde;
103+
}
104+
.highlight code .m {
105+
color: #d8985f;
106+
}
107+
.highlight code .nb {
108+
color: #f5c876;
109+
font-style: italic;
110+
}
111+
.highlight code .sa,
112+
.highlight code .sb,
113+
.highlight code .sc,
114+
.highlight code .dl,
115+
.highlight code .sd,
116+
.highlight code .hll,
117+
.highlight code .no,
118+
.highlight code .s {
119+
color: #f5c876;
120+
}
121+
.highlight code .nf {
122+
color: #52adf2;
123+
}
124+
.highlight code .nl {
125+
color: #aab1c0;
126+
font-style: italic;
127+
}
128+
.highlight code .n,
129+
.highlight code .gd,
130+
.highlight code .nt {
131+
color: #ef596f;
132+
}
133+
.highlight code .mb,
134+
.highlight code .ow .highlight code .mf,
135+
.highlight code .si .highlight code .il .highlight code .mh,
136+
.highlight code .mi,
137+
.highlight code .mo {
138+
color: #d55fde;
139+
}
140+
.highlight code .nc,
141+
.highlight code .gi,
142+
.highlight code .s2,
143+
.highlight code .sh,
144+
.highlight code .fm,
145+
.highlight code .sx {
146+
color: #98c379;
147+
}
148+
.highlight code .se,
149+
.highlight code .sr,
150+
.highlight code .nd,
151+
.highlight code .na,
152+
.highlight code .s1,
153+
.highlight code .ss {
154+
color: #33d8e4;
155+
}
156+
.highlight code .bp {
157+
color: #aab1c0;
158+
font-style: italic;
159+
}
160+
.highlight code .nv,
161+
.highlight code .vc,
162+
.highlight code .vg,
163+
.highlight code .vi,
164+
.highlight code .vm {
165+
color: #8be9fd;
166+
font-style: italic;
167+
}
168+
}
169+
170+
@layer utilities {
171+
[x-cloak] {
172+
@apply hidden;
173+
}
174+
}

src/_components/content_block.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def classes
1515
prose-pre:bg-zinc-800
1616
prose-pre:px-2
1717
prose-zinc
18-
prose-a:text-pink-500
18+
prose-a:text-rose-500
1919
dark:prose-a:text-sky-400
2020
prose-a:no-underline
2121
hover:prose-a:underline

src/_posts/archive/unhide-macos-desktop-icons.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ tags:
77
- zsh
88
- macos
99
- alfred
10-
category: til
10+
categories: til
1111
date: '2021-06-05T11:22:38-07:00'
12-
last_modified_at: '2022-01-29T17:01:41.558Z'
12+
last_modified_at: '2022-02-08T02:18:47.187Z'
1313
---
1414

1515
One day I realized all of the desktop icons on my 2019 MacBook Pro were missing, but still visible in Finder. I thought maybe it was a bug in Big Sur 11.4 but I eventually found the solution.

src/_posts/getting-started-with-obsidian.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ tags:
77
- obsidian
88
- macos
99
- notes
10-
category: tutorial
10+
categories: tutorial
1111
date: "2022-01-14T06:49:07.800Z"
12-
last_modified_at: "2022-01-29T17:01:41.394Z"
12+
last_modified_at: "2022-02-08T02:18:42.389Z"
1313
---
1414

1515
## Quick Start

src/_snippets/alfred-custom-terminal.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ tags:
55
- warp
66
- macos
77
- archipelago
8-
category: alfred
8+
categories: alfred
99
date: "2022-01-14T06:49:07.800Z"
10-
last_modified_at: "2022-02-08T01:31:09.158Z"
10+
last_modified_at: "2022-02-08T02:18:35.929Z"
1111
---
1212

1313
```applescript

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { fontFamily } = require("tailwindcss/defaultTheme")
22

33
module.exports = {
4-
content: ["./src/**/*.*{md,rb,erb,html}", "./frontend/javascript/**/*.js"],
4+
content: ["./src/**/*.{md,rb,erb,html}", "./frontend/javascript/**/*.js"],
55
darkMode: "class",
66
theme: {
77
container: {

0 commit comments

Comments
 (0)