-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MERGE] PR #8 - stylebucket/bugfix/css-func-escape-str
- Loading branch information
Showing
17 changed files
with
3,019 additions
and
1,563 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
FROM node:20 | ||
|
||
# PNPM | ||
RUN npm install -g pnpm | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
# Install chromium Dependencies | ||
RUN pnpm dlx playwright install-deps chromium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Used for DevContainer postCreateCommand | ||
|
||
# Install pnpm version specified in package.json files. | ||
corepack install | ||
|
||
# Install Packages | ||
pnpm install --frozen-lockfile | ||
pnpm exec playwright install chromium --with-deps | ||
|
||
# Install Chromium Browser to Project | ||
pnpm exec playwright install chromium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
import { css } from '@stylebucket/css'; | ||
|
||
import { test, expect } from 'vitest'; | ||
import { parseCss } from './parse'; | ||
|
||
test('ParseCss With PostCSS Prop', () => { | ||
|
||
const css = ` | ||
const styles = css` | ||
@media all and (min-width: 1200px) { | ||
.my-class { | ||
display: somePostCssFunction(); | ||
} | ||
.\@root { | ||
font-size: 12px; | ||
} | ||
} | ||
`; | ||
|
||
const exp = ('' | ||
+ '@media all and (min-width: 1200px)' | ||
+ '{.my-class{display:somePostCssFunction()}}' | ||
+ '@media all and (min-width: 1200px){' | ||
+ '.my-class{display:somePostCssFunction()}' | ||
+ '.\\@root{font-size:12px}' | ||
+ '}' | ||
); | ||
|
||
expect(parseCss(css).css).toBe(exp); | ||
expect(parseCss(styles).css).toBe(exp); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,38 @@ | ||
import { test, expect } from 'vitest'; | ||
import { parseCss } from '@stylebucket/compiler'; | ||
|
||
import { css } from './css'; | ||
|
||
const color = 'green'; | ||
const size = 14; | ||
|
||
const styles = css` | ||
.test-class { | ||
color: ${color}; | ||
font-size: 12px; | ||
font-size: ${size}px; | ||
} | ||
.another-test-class { | ||
background: ${color}; | ||
} | ||
/* Some CSS Comment */ | ||
.\@root { | ||
font-size: 10px; | ||
} | ||
`; | ||
|
||
test('css function', () => { | ||
|
||
const expectRes = ('' | ||
+ '.test-class{color:green;font-size:12px}' | ||
+ '.another-test-class{background:green}' | ||
const stylesMinified = styles.replace(/\s/g,''); | ||
const stylesMinifiedExpect = ('' | ||
+ '.test-class{color:green;font-size:14px;}' | ||
+ '.another-test-class{background:green;}' | ||
+ '/*SomeCSSComment*/' | ||
+ '.\\@root{font-size:10px;}' | ||
); | ||
|
||
const { css: parsed } = parseCss(styles); | ||
|
||
expect(parsed).toBe(expectRes); | ||
|
||
/* Need to double escape ('.\\') only for the test case | ||
as we need to escape the escape in this string. | ||
The css`` func only outputs a single escape | ||
as written */ | ||
expect(stylesMinified).toBe(stylesMinifiedExpect); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.