postcss-custom-properties-fallback
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -14,3 +14,3 @@ const fs = require('fs'); | ||
const root = postcss.parse(css, { | ||
postcss.parse(css, { | ||
from | ||
@@ -17,0 +17,0 @@ }); |
@@ -10,5 +10,9 @@ const getCustomPropertiesFromImports = require('./import-from.js'); | ||
const isTransformableDecl = decl => customPropertiesRegExp.test(decl.value); // eslint-disable-next-line no-empty-pattern | ||
const isTransformableDecl = decl => customPropertiesRegExp.test(decl.value); | ||
const { | ||
nodeToString | ||
} = require('postcss-values-parser'); // eslint-disable-next-line no-empty-pattern | ||
module.exports = opts => ({ | ||
@@ -35,3 +39,3 @@ postcssPlugin: 'postcss-custom-properties-fallback', | ||
if (fallback) { | ||
if (fallback && fallback.length === 1) { | ||
node.nodes.push({ | ||
@@ -44,2 +48,13 @@ type: 'divider', | ||
}); | ||
} //when fallback value contains more then one node, stringify them with value parser used to parse the customProperties object and add as one node type word. | ||
if (fallback && fallback.length > 1) { | ||
node.nodes.push({ | ||
type: 'divider', | ||
value: ',' | ||
}, { | ||
type: 'word', | ||
value: fallback.map(fallbackNode => nodeToString(fallbackNode)).join(' ') | ||
}); | ||
} | ||
@@ -46,0 +61,0 @@ }); |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "dist/plugin.js", | ||
@@ -26,4 +26,4 @@ "files": [ | ||
"dependencies": { | ||
"postcss-value-parser": "^4.1.0", | ||
"postcss-values-parser": "^4.0.0" | ||
"postcss-value-parser": "^4.2.0", | ||
"postcss-values-parser": "^6.0.2" | ||
}, | ||
@@ -34,6 +34,6 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"eslint": "^7.13.0", | ||
"microbundle": "^0.12.4", | ||
"postcss": "^8.1.8", | ||
"tap": "^14.10.8" | ||
"eslint": "^8.11.0", | ||
"microbundle": "^0.14.2", | ||
"postcss": "^8.4.12", | ||
"tap": "^16.0.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "keywords": [ |
@@ -61,3 +61,3 @@ # PostCSS Custom Properties Fallback | ||
```bash | ||
npm install postcss-custom-properties--fallback --save-dev | ||
npm install postcss-custom-properties-fallback --save-dev | ||
``` | ||
@@ -64,0 +64,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22473
133
+ Addedpostcss-values-parser@6.0.2(transitive)
+ Addedquote-unquote@1.0.0(transitive)
- Removedpicocolors@0.2.1(transitive)
- Removedpostcss@7.0.39(transitive)
- Removedpostcss-values-parser@4.0.0(transitive)
- Removedsource-map@0.6.1(transitive)
Updatedpostcss-value-parser@^4.2.0
Updatedpostcss-values-parser@^6.0.2