Thanks for giving this a go. Hope this helps and makes your coding more efficient and fun.
Animations coming soon.
Pull requests are most welcome!
- Launch the Command Pallete (Ctrl + Shift + P or ⌘Cmd + Shift + P) and type "Install Extensions" (or navigate from the sidebar to Extensions tab).
- In search box type in "iJS" and choose the Emotion Snippets
- Install the extension (you may need to relaunch VS Code)
- Get a coffee, a cookie and celebrate by expanding some emotion.js snippets!
- JavaScript (.js)
- TypeScript (.ts)
- JavaScript React (.jsx)
- TypeScript React (.tsx)
Below is a list of all available snippets and the triggers of each one. The ⇥ means the TAB
key.
Trigger | Content |
---|---|
ecss → |
Declared an emotion css style variable |
ecn → |
Creates ClassNames HOC with render props |
eobjcss → |
Declared an emotion css style variable with object styles |
eusthm → |
Declare them with useTheme() from emotion-theming |
imecn → |
Import ClassNames from @emotion/core |
imecss → |
Import css from @emotion/core |
imej → |
Imports emotion jsx prop |
imejcss → |
Imports emotion jsx and css props |
imesc → |
Import styled from emotion/styled (requires package) |
imeusthm → |
Import useTheme from emotion-theming (requires package) |
sc → |
Declare styled component |
scw → |
Declare custom component wrapped in a styled component |
- More snippets to come, stay tuned!
import { ClassNames } from "@emotion/core";
import { css } from "@emotion/core";
// below comment line is required
// it tells babel how to convert properly
/** @jsx jsx */
import { jsx } from "@emotion/core";
// below comment line is required
// it tells babel how to convert properly
/** @jsx jsx */
import { jsx, css } from "@emotion/core";
import styled from "@emotion/styled";
import { useTheme } from "emotion-theming";
const style| = css`
|
`;
const objectStyles| = css({
|
})
const theme = useTheme();
const sc| = styled.div`
|
`;
const sc| = styled(CustomComp|)`
|
`;
- [BREAKING]: Final renaming of base snippets
ecn →
| Fix typo to properly close ClassNames element
- [BREAKING]: Refactored most snippets to shorter versions.
eimpclnm →
| Import ClassNames from @emotion/coreeclnm →
| Creates ClassNames HOC with render props
- [BREAKING]: Renamed all
em*
snippet instances toe*
stprop →
- added filename base to styled component definition
-
`emimpcss→` | Import css from @emotion/core
-
emimpstyled→
| Import styled from emotion -
`sc→` | Declare styled component
-
scw→
| Declare custom component wrapped in a styled component -
`stprop→` | Universal destructuring of a prop template literal
-
`emimptheme→` | Import useTheme from emotion
-
`emusetheme→` | Declare them with useTheme() from emotion
-
`emcss→` | Declared an emotion css style variable
-
`emobjcss→` | Declared an emotion css style variable with object styles
-
`emimpjsx→` | Imports emotion jsx prop
-
emimpjsxcss→
| Imports emotion jsx and css props -
Initial Emotion Snippets Release
Enjoy! / Scott Agirs