Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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.
Basically it works like styled-theming:
import styled, { theme } from 'vue-emotion'
const color = theme('mode', {
light: 'black',
dark: 'white'
})
const backgroundColor = theme('mode', {
light: 'white',
dark: 'black'
})
const Button = styled('button')`
color: ${color};
background-color: ${backgroundColor};
border: 1px solid ${color};
padding: 10px 20px;
`
new Vue({
data: {
theme: {
mode: 'light'
}
},
provide() {
return {
theme: this.theme
}
},
render() {
return <Button>hi</Button>
}
})
// .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
The npm package vue-emotion receives a total of 397 weekly downloads. As such, vue-emotion popularity was classified as not popular.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.