Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
661 bytes
|
Line | |
---|
1 | import postcss from 'postcss';
|
---|
2 |
|
---|
3 | const gapPropertyRegExp = /^(column-gap|gap|row-gap)$/i;
|
---|
4 | var index = postcss.plugin('postcss-gap-properties', opts => {
|
---|
5 | const preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;
|
---|
6 | return root => {
|
---|
7 | // for each shorthand gap, column-gap, or row-gap declaration
|
---|
8 | root.walkDecls(gapPropertyRegExp, decl => {
|
---|
9 | // insert a grid-* fallback declaration
|
---|
10 | decl.cloneBefore({
|
---|
11 | prop: `grid-${decl.prop}`
|
---|
12 | }); // conditionally remove the original declaration
|
---|
13 |
|
---|
14 | if (!preserve) {
|
---|
15 | decl.remove();
|
---|
16 | }
|
---|
17 | });
|
---|
18 | };
|
---|
19 | });
|
---|
20 |
|
---|
21 | export default index;
|
---|
22 | //# sourceMappingURL=index.es.mjs.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.