Skip to content

Commit

Permalink
fix: fix transformed quotes, close #37
Browse files Browse the repository at this point in the history
  • Loading branch information
ModyQyW committed Nov 7, 2024
1 parent fcb65c2 commit ce18454
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/template/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe("template", () => {
`<view class="{{['w-[10%]','bg-[#fff]',virtualHostClass]}}"></view>`,
),
).toBe(
`<view class="{{[\\"w--10-p--\\",\\"bg---h-fff-\\",virtualHostClass]}}"></view>`,
`<view class="{{['w--10-p--','bg---h-fff-',virtualHostClass]}}"></view>`,
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tools/babel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("babel", () => {
expect(babelTransformClass("w-[10%]")).toBe("w--10-p--");
expect(
babelTransformClass(`{{['w-[10%]','bg-[#fff]',virtualHostClass]}}`),
).toBe(`{{["w--10-p--","bg---h-fff-",virtualHostClass]}}`);
).toBe(`{{['w--10-p--','bg---h-fff-',virtualHostClass]}}`);
expect(babelTransformClass("*:rounded-full")).toBe("-w-_rounded-full");
});

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/tools/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const babelTransformClass = (
if (transformed?.code)
newSource = newSource.replace(
ReplaceMarker,
transformed.code.replace(/;$/, ""),
transformed.code.replace(/;$/, "").replace(/"/g, "'"),
);
}
return newSource;
Expand Down

0 comments on commit ce18454

Please sign in to comment.