source: frontend/node_modules/postcss-merge-longhand/src/lib/minifyWsc.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 732 bytes
Line 
1'use strict';
2const parseWsc = require('./parseWsc.js');
3const minifyTrbl = require('./minifyTrbl.js');
4const { isValidWsc } = require('./validateWsc.js');
5
6const defaults = ['medium', 'none', 'currentcolor'];
7
8/** @type {(v: string) => string} */
9module.exports = (v) => {
10 const values = parseWsc(v);
11
12 if (!isValidWsc(values)) {
13 return minifyTrbl(v);
14 }
15
16 const value = [...values, '']
17 .reduceRight((prev, cur, i, arr) => {
18 if (
19 cur === undefined ||
20 (cur.toLowerCase() === defaults[i] &&
21 (!i || (arr[i - 1] || '').toLowerCase() !== cur.toLowerCase()))
22 ) {
23 return prev;
24 }
25
26 return cur + ' ' + prev;
27 })
28 .trim();
29
30 return minifyTrbl(value || 'none');
31};
Note: See TracBrowser for help on using the repository browser.