Skip to content

Commit fd87f3a

Browse files
authoredDec 7, 2024··
fix: static css + build info (#3018)
* fix: static css + build info * test: write encoder tests
1 parent af9715a commit fd87f3a

File tree

3 files changed

+51
-2
lines changed

3 files changed

+51
-2
lines changed
 

‎.changeset/friendly-knives-stare.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@pandacss/node': patch
3+
---
4+
5+
Fix issue where `staticCss` artifacts were not included in the build info json.

‎packages/core/__tests__/style-encoder.test.ts

+40
Original file line numberDiff line numberDiff line change
@@ -737,4 +737,44 @@ describe('style encoder', () => {
737737
}
738738
`)
739739
})
740+
741+
test('static css - recipes', () => {
742+
const ctx = createGeneratorContext()
743+
ctx.staticCss.process({ recipes: '*' })
744+
expect(ctx.encoder.toJSON()).toMatchInlineSnapshot(`
745+
{
746+
"schemaVersion": "x.x.x",
747+
"styles": {
748+
"atomic": [
749+
"color]___[value:ButtonHighlight",
750+
],
751+
"recipes": {
752+
"badge": [
753+
"size]___[value:sm]___[recipe:badge",
754+
"raised]___[value:true]___[recipe:badge",
755+
],
756+
"buttonStyle": [
757+
"size]___[value:md]___[recipe:buttonStyle",
758+
"variant]___[value:solid]___[recipe:buttonStyle",
759+
"size]___[value:sm]___[recipe:buttonStyle",
760+
"variant]___[value:outline]___[recipe:buttonStyle",
761+
],
762+
"cardStyle": [
763+
"rounded]___[value:true]___[recipe:cardStyle",
764+
],
765+
"checkbox": [
766+
"size]___[value:sm]___[recipe:checkbox",
767+
"size]___[value:md]___[recipe:checkbox",
768+
"size]___[value:lg]___[recipe:checkbox",
769+
],
770+
"textStyle": [
771+
"size]___[value:h1]___[recipe:textStyle",
772+
"size]___[value:h2]___[recipe:textStyle",
773+
],
774+
"tooltipStyle": [],
775+
},
776+
},
777+
}
778+
`)
779+
})
740780
})

‎packages/node/src/build-info.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ import type { PandaContext } from './create-context'
33

44
export async function buildInfo(ctx: PandaContext, outfile: string) {
55
const { filesWithCss, files } = ctx.parseFiles()
6-
76
logger.info('cli', `Found ${colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`)
87

9-
const minify = ctx.config.minify
8+
const { minify, staticCss } = ctx.config
109
logger.info('cli', `Writing ${minify ? '[min] ' : ' '}${colors.bold(outfile)}`)
1110

11+
if (staticCss) {
12+
logger.info('cli', 'Adding staticCss definitions...')
13+
ctx.staticCss.process(staticCss)
14+
}
15+
1216
const output = JSON.stringify(ctx.encoder.toJSON(), null, minify ? 0 : 2)
1317

1418
ctx.output.ensure(outfile, process.cwd())

0 commit comments

Comments
 (0)
Please sign in to comment.