Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

v-css-var

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

v-css-var - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

30

index.js

@@ -1,2 +0,2 @@

/* eslint-disable no-useless-return,no-useless-escape,camelcase,semi,no-cond-assign */
/* eslint-disable no-useless-return,no-useless-escape,camelcase,semi,no-cond-assign,no-unused-vars */
const env = process.env.NODE_ENV

@@ -6,3 +6,3 @@ const handleVars = (varItem, addPrefix) => {

if (addPrefix) {
varItem[0] = '--' + varItem[0]
varItem[0] = '--' + varItem[0].replace('--', '')
}

@@ -52,13 +52,23 @@ return {

// get all cssVars in the dom
const styleList = dom.style.cssText.split(';').map(e => e.split(':')).filter(e => e[0] !== '')
const vars = Object.entries(binding.value)
for (const k of vars) {
const {
varsName,
varsValue
} = handleVars(k, options.prefix)
const oldValue = dom.style.getPropertyValue(varsName)
if (oldValue !== varsValue) {
dom.style.setProperty(varsName, varsValue)
// 更新当前变量
if (vars.length > 0) {
for (const k of vars) {
const {
varsName,
varsValue
} = handleVars(k, options.prefix)
const oldValue = document.body.style.getPropertyValue(varsName)
if (oldValue !== varsValue) {
dom.style.setProperty(varsName, varsValue)
}
}
}
for (const k of styleList) {
const key = options.prefix ? k[0].replace('--', '') : k[0]
if (!vars.find(e => e[0] === key)) {
dom.style.removeProperty(k[0])
}
}
}

@@ -65,0 +75,0 @@ })

{
"name": "v-css-var",
"version": "1.0.0",
"version": "1.0.1",
"description": "use CSS Variables by vue directive",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -56,2 +56,3 @@ # v-css-var

#### TO DO
- [ ] remove the css Variables
- [x] remove the css Variables
- [ ] write the test
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc