source: frontend/node_modules/stylehacks/src/plugins/important.js

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: 697 bytes
Line 
1'use strict';
2const BasePlugin = require('../plugin');
3const { IE_5_5, IE_6, IE_7 } = require('../dictionary/browsers');
4const { DECL } = require('../dictionary/postcss');
5
6module.exports = class Important extends BasePlugin {
7 /** @param {import('postcss').Result=} result */
8 constructor(result) {
9 super([IE_5_5, IE_6, IE_7], [DECL], result);
10 }
11 /**
12 * @param {import('postcss').Declaration} decl
13 * @return {void}
14 */
15 detect(decl) {
16 const match = decl.value.match(/!\w/);
17 if (match && match.index) {
18 const hack = decl.value.substr(match.index, decl.value.length - 1);
19 this.push(decl, {
20 identifier: '!important',
21 hack,
22 });
23 }
24 }
25};
Note: See TracBrowser for help on using the repository browser.