|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | module.exports = function(options) {
|
|---|
| 2 | return {
|
|---|
| 3 | postcssPlugin: 'postcss-page-break',
|
|---|
| 4 | Declaration(decl) {
|
|---|
| 5 | if (decl.prop.startsWith('break-') && /^break-(inside|before|after)/.test(decl.prop)) {
|
|---|
| 6 | // do not process column|region related properties
|
|---|
| 7 | if (decl.value.search(/column|region/) >= 0) {
|
|---|
| 8 | return;
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | let newValue;
|
|---|
| 12 | switch (decl.value) {
|
|---|
| 13 | case 'page':
|
|---|
| 14 | newValue = 'always';
|
|---|
| 15 | break;
|
|---|
| 16 | case 'avoid-page':
|
|---|
| 17 | newValue = 'avoid';
|
|---|
| 18 | break;
|
|---|
| 19 | default:
|
|---|
| 20 | newValue = decl.value;
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | const newProperty = 'page-' + decl.prop;
|
|---|
| 24 | if (decl.parent.every((sibling) => sibling.prop !== newProperty)) {
|
|---|
| 25 | decl.cloneBefore({
|
|---|
| 26 | prop: newProperty,
|
|---|
| 27 | value: newValue,
|
|---|
| 28 | });
|
|---|
| 29 | }
|
|---|
| 30 | }
|
|---|
| 31 | },
|
|---|
| 32 | };
|
|---|
| 33 |
|
|---|
| 34 | };
|
|---|
| 35 | module.exports.postcss = true;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.