|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
702 bytes
|
| Line | |
|---|
| 1 | var postcss = require('postcss');
|
|---|
| 2 |
|
|---|
| 3 | module.exports = function(decl) {
|
|---|
| 4 | var regex = /(\d{1,}) (\d{1,}) (calc\(.*\))/g;
|
|---|
| 5 | var matches = regex.exec(decl.value);
|
|---|
| 6 | if (decl.prop === 'flex' && matches) {
|
|---|
| 7 | var grow = postcss.decl({
|
|---|
| 8 | prop: 'flex-grow',
|
|---|
| 9 | value: matches[1],
|
|---|
| 10 | source: decl.source
|
|---|
| 11 | });
|
|---|
| 12 | var shrink = postcss.decl({
|
|---|
| 13 | prop: 'flex-shrink',
|
|---|
| 14 | value: matches[2],
|
|---|
| 15 | source: decl.source
|
|---|
| 16 | });
|
|---|
| 17 | var basis = postcss.decl({
|
|---|
| 18 | prop: 'flex-basis',
|
|---|
| 19 | value: matches[3],
|
|---|
| 20 | source: decl.source
|
|---|
| 21 | });
|
|---|
| 22 | decl.parent.insertBefore(decl, grow);
|
|---|
| 23 | decl.parent.insertBefore(decl, shrink);
|
|---|
| 24 | decl.parent.insertBefore(decl, basis);
|
|---|
| 25 | decl.remove();
|
|---|
| 26 | }
|
|---|
| 27 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.