Skip to content

Commit

Permalink
switch back to inline
Browse files Browse the repository at this point in the history
  • Loading branch information
jantimon committed Jul 17, 2024
1 parent e9afb2e commit fa46cda
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ jobs:
- name: Build with SWC
run: pnpm run build:swc

- name: Enable caching
uses: Swatinem/rust-cache@v2
with:
workspaces: packages/yak-swc

- name: Link Vercel project
run: vercel link --yes --token ${{ secrets.VERCEL_TOKEN }}

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/swc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@ jobs:
- name: Run cargo test
run: cargo test --manifest-path packages/yak-swc/Cargo.toml
- name: Run cargo fmt
run: cargo fmt --manifest-path packages/yak-swc/Cargo.toml --all -- --check
- name: Run cargo clippy
run: cargo clippy --manifest-path packages/yak-swc/Cargo.toml -- -D warnings
run: cargo fmt --manifest-path packages/yak-swc/Cargo.toml --all -- --check
4 changes: 2 additions & 2 deletions packages/yak-swc/yak_swc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ where
let next_css_code = pair.next_quasi.map(|next_quasi| next_quasi.raw.to_string());
if is_mixin_expression(
css_state.clone(),
encode_module_import(module_path.as_str(), "selector", vec![id.sym.to_string()]),
encode_module_import(module_path.as_str(), "inline", vec![id.sym.to_string()]),
next_css_code,
) {
if current_css_state.current_scopes.len() == 1 {
Expand All @@ -466,7 +466,7 @@ where
// An imported constant
else {
let css_code =
encode_module_import(module_path.as_str(), "selector", vec![id.sym.to_string()]);
encode_module_import(module_path.as_str(), "inline", vec![id.sym.to_string()]);
let (new_state, _) = parse_css(&css_code, css_state);
css_state = Some(new_state);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { colors } from "./colors";
import { fonts } from "./fonts";
export const Button = /*YAK Extracted CSS:
.Button {
font-size: --yak-css-import: url("./fonts:selector:fonts");
color: --yak-css-import: url("./colors:selector:colors");
background-color: --yak-css-import: url("./colors:selector:colors");
font-size: --yak-css-import: url("./fonts:inline:fonts");
color: --yak-css-import: url("./colors:inline:colors");
background-color: --yak-css-import: url("./colors:inline:colors");
}
*/ /*#__PURE__*/ styled.button(__styleYak.Button);
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { fonts } from "./fonts";
import { fancy } from "./fancy";
export const Button = /*YAK Extracted CSS:
.Button {
--yak-css-import: url("./fonts:selector:fonts");
--yak-css-import: url("./fonts:inline:fonts");
}
*/ /*#__PURE__*/ styled.button(__styleYak.Button);
export const Button2 = /*#__PURE__*/ styled.button(fonts.h1);
Expand All @@ -17,7 +17,7 @@ export const Button3 = /*YAK Extracted CSS:
*/ /*#__PURE__*/ styled.button(__styleYak.Button3, fonts.h1);
export const Button4 = /*YAK Extracted CSS:
.Button4 {
--yak-css-import: url("./fonts:selector:fonts")
--yak-css-import: url("./fonts:inline:fonts")
;
color: green;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/yak-swc/yak_swc/tests/fixture/cross-file/output.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export const Button = /*YAK Extracted CSS:
.Button {
font-size: 1rem;
color: green;
--yak-css-import: url("./Icon:selector:Icon") {
--yak-css-import: url("./Icon:inline:Icon") {
color: red;
}
--yak-css-import: url("./Icon:selector:Icon") --yak-css-import: url("./Icon:selector:Icon") {
--yak-css-import: url("./Icon:inline:Icon") --yak-css-import: url("./Icon:inline:Icon") {
color: blue;
}
}
Expand Down

0 comments on commit fa46cda

Please sign in to comment.