Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Add support for vue-emotion
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlangelaan committed Sep 15, 2020
1 parent 0b4beda commit b47bc5e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
7 changes: 7 additions & 0 deletions extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ const supports = {
// import styled from "react-emotion";
'react-emotion': true,

// import styled from 'vue-emotion';
// Also see:
// - https://github.com/stylelint/stylelint/issues/4247
// - https://github.com/gucong3000/postcss-jsx/issues/63
// - https://github.com/stylelint/postcss-css-in-js/issues/22
'vue-emotion': true,

// import styled from 'preact-emotion'
'preact-emotion': true,

Expand Down
31 changes: 31 additions & 0 deletions test/emotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,35 @@ describe('javascript tests', () => {
});
});
});

it('works with vue-emotion', () => {
// Related issues:
// - https://github.com/stylelint/stylelint/issues/4247
// - https://github.com/gucong3000/postcss-jsx/issues/63
// - https://github.com/stylelint/postcss-css-in-js/issues/22
const parsed = syntax.parse(`
import styled from 'vue-emotion';
const Wrapper = styled('div')\`
left: 0;
top: 0;
width: 100%;
height: 100%;
\`;
`);

expect(parsed.nodes).toHaveLength(1);
});

it('works with @emotion/styled', () => {
const parsed = syntax.parse(`
import styled from '@emotion/styled';
const Wrapper = styled.div\`
left: 0;
\`;
`);

expect(parsed.nodes).toHaveLength(1);
});
});

0 comments on commit b47bc5e

Please sign in to comment.