Skip to content

Commit

Permalink
fix(jsx-email): use custom minify preset (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
shellscape committed Feb 23, 2024
1 parent f6bcc01 commit e33edee
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 134 deletions.
1 change: 1 addition & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:

- name: Build Projects
run: |
moon minify-preset:build
moon jsx-email:build
moon create-jsx-email:build
Expand Down
4 changes: 2 additions & 2 deletions packages/jsx-email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"url": "https://github.com/shellscape/jsx-email.git",
"directory": "packages/jsx-email"
},
"author": "Andrew Powell <andrew@shellscape.org>",
"homepage": "https://jsx.email/",
"main": "dist/index.js",
"bin": {
Expand Down Expand Up @@ -47,6 +48,7 @@
"dependencies": {
"@dot/log": "^0.1.3",
"@jsx-email/doiuse-email": "^1.0.1",
"@jsx-email/minify-preset": "workspace:^",
"@radix-ui/react-slot": "1.0.2",
"@unocss/core": "^0.58.3",
"@unocss/preset-typography": "^0.58.3",
Expand All @@ -73,7 +75,6 @@
"pretty": "2.0.0",
"pretty-bytes": "^5.6.0",
"rehype": "^13.0.1",
"rehype-preset-minify": "^7.0.0",
"rehype-stringify": "^10.0.0",
"rollup-plugin-hypothetical": "^2.1.1",
"shikiji": "0.9.19",
Expand All @@ -98,7 +99,6 @@
"hast": "^1.0.0"
},
"types": "dist/index.d.mts",
"bump": "0",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/shellscape"
Expand Down
7 changes: 2 additions & 5 deletions packages/jsx-email/src/render/process.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { minifyPreset } from '@jsx-email/minify-preset';
// Note: For some reason CI has a hard time with this, even though the dependency is installed, and
// it builds locally fine
// @ts-ignore
Expand Down Expand Up @@ -57,11 +58,7 @@ export const processHtml = async ({ html, minify, pretty }: ProcessOptions) => {
}

let processor = rehype().data('settings', settings).use(rehypeMoveStyle);

if (minify) {
const { default: rehypeMinify } = await import('rehype-preset-minify');
processor = processor.use(rehypeMinify);
}
if (minify) processor = processor.use(await minifyPreset());

const doc = await processor
.use(stringify, {
Expand Down
130 changes: 3 additions & 127 deletions pnpm-lock.yaml

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

0 comments on commit e33edee

Please sign in to comment.