
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
vue-emotion
Advanced tools
emotion is the Next Generation of CSS-in-JS.
yarn add emotion vue-emotion
Add the babel plugin first:
{
"plugins": [
"emotion/babel"
]
}
Then create your styled component:
import styled from 'vue-emotion'
const Button = styled('button')`
font-size: 15px;
`
const PinkButton = styled(Button)`
color: pink
`
new Vue({
render() {
return (
<div>
<Button>normal button</Button>
<PinkButton>pink button</PinkButton>
</div>
)
}
})
Refer to https://github.com/tkh44/emotion for more docs.
// .babelrc
{
"plugins": [
["emotion/babel", { "extractStatic": true }]
]
}
Check out the doc about extractStatic.
Then when you write something like:
import styled from 'vue-emotion'
const H1 = styled('h1')`
color: #ffd43b;
`
It will be compiled to:
import './h1.emotion.css'
import styled from 'vue-emotion'
const H1 = styled('h1', 'css-duiy4a')
Basically you can treat .emotion.css
as normal CSS file and configure the loader for it in webpack config, since we're trying to make SSR work, you will need vue-style-loader
instead of style-loader
for it.
Check out https://github.com/tkh44/emotion/blob/master/docs/ssr.md, it does not support streaming though.
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
vue-emotion © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).
github.com/egoist · GitHub @EGOIST · Twitter @_egoistlily
FAQs
Seamlessly use emotion (CSS-in-JS) with Vue.js
We found that vue-emotion demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.