Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
856 bytes
|
Line | |
---|
1 | var postcss = require('postcss');
|
---|
2 |
|
---|
3 | module.exports = postcss.plugin('postcss-page-break', function () {
|
---|
4 |
|
---|
5 | return function (root) {
|
---|
6 |
|
---|
7 | root.walkDecls(/^break-(inside|before|after)/, function (decl) {
|
---|
8 | // do not process column|region related properties
|
---|
9 | if (decl.value.search(/column|region/) >= 0) {
|
---|
10 | return;
|
---|
11 | }
|
---|
12 |
|
---|
13 | var newValue;
|
---|
14 | switch (decl.value) {
|
---|
15 | case 'page':
|
---|
16 | newValue = 'always';
|
---|
17 | break;
|
---|
18 | case 'avoid-page':
|
---|
19 | newValue = 'avoid';
|
---|
20 | break;
|
---|
21 | default:
|
---|
22 | newValue = decl.value;
|
---|
23 | }
|
---|
24 |
|
---|
25 | decl.cloneBefore({
|
---|
26 | prop: 'page-' + decl.prop,
|
---|
27 | value: newValue
|
---|
28 | });
|
---|
29 | });
|
---|
30 |
|
---|
31 | };
|
---|
32 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.