postcss-import-ext-glob
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -6,2 +6,6 @@ # Change Log | ||
## 2.1.0 - 2022-11-30 | ||
### Added | ||
- Adds the possibility to define layer parameters to the import rule, thanks to @argyleink. See issue #3 | ||
## 2.0.1 - 2021-01-31 | ||
@@ -8,0 +12,0 @@ ### Fixed |
10
index.js
@@ -22,2 +22,3 @@ const valueParser = require('postcss-value-parser'); | ||
const globList = []; | ||
const layer = new Map(); | ||
@@ -37,2 +38,5 @@ const params = valueParser(rule.params).nodes; | ||
} | ||
if (param.type === 'function' && param.value === 'layer') { | ||
layer.set(dirName, param.nodes[0].value); | ||
} | ||
} | ||
@@ -51,6 +55,10 @@ | ||
sortedEntries.forEach((entry) => { | ||
const paramValue = layer.get(dirName) | ||
? `"${entry}" layer(${layer.get(dirName)})` | ||
: `"${entry}"`; | ||
rule.before( | ||
new AtRule({ | ||
name: 'import', | ||
params: `"${entry}"`, | ||
params: paramValue, | ||
source: rule.source, | ||
@@ -57,0 +65,0 @@ }) |
{ | ||
"name": "postcss-import-ext-glob", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A PostCSS plugin to extend postcss-import path resolver to allow glob usage as path", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
13
test.js
@@ -172,1 +172,14 @@ const test = require('ava'); | ||
}); | ||
test('layer test', async (t) => { | ||
const input = ` | ||
@import-glob "fixtures/css/foo/**/*.css" layer(test); | ||
`; | ||
const output = ` | ||
@import "${__dirname}/fixtures/css/foo/bar.css" layer(test); | ||
@import "${__dirname}/fixtures/css/foo/foo.css" layer(test); | ||
`; | ||
await tester.test(input, output, t); | ||
}); |
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
11172
225