stylus/tools/test.js

17 lines
495 B
JavaScript
Raw Normal View History

'use strict';
const fs = require('fs');
testGlobalCss();
function testGlobalCss() {
2021-12-12 15:14:31 +00:00
const css = fs.readFileSync('dist/global.css', {encoding: 'utf8'});
const ERR = 'global.css: missing the transition suppressor rule';
2021-04-20 17:27:07 +00:00
const RX_SUPPRESSOR = /[^{}]+#\\1\s?transition-suppressor[^{}]+{\s*transition:\s*none\s*!\s*important/i;
const RX_COMMENT = /\/\*([^*]|\*(?!\/))*(\*\/|$)/g;
if (!RX_SUPPRESSOR.test(css.replace(RX_COMMENT, ''))) {
console.error(ERR);
process.exit(1);
}
}