36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
const fs = require("fs");
|
|
const css = require("css");
|
|
|
|
fs.readFile("/app/style.css", "utf-8", (err, a) => {
|
|
let data = "";
|
|
if(err === null) {
|
|
data = a + "\n";
|
|
}
|
|
fs.readFile("/app/setup/chromecast.css", "utf-8", (err, b) => {
|
|
if(err === null) {
|
|
data += b + "\n";
|
|
}
|
|
const ast = css.parse(data);
|
|
for(const rule of ast.stylesheet.rules) {
|
|
const decls = [];
|
|
if(Symbol.iterator in Object(rule.declarations)) {
|
|
for(const decl of rule.declarations) {
|
|
const isNotUrl = !(decl.value.toLowerCase().startsWith("url"));
|
|
const isNotContent = !(decl.property.toLowerCase() == "content");
|
|
if(isNotContent && isNotUrl) {
|
|
decls.push(decl);
|
|
}
|
|
}
|
|
rule.declarations = decls;
|
|
}
|
|
}
|
|
fs.writeFile("/app/style.css", css.stringify(ast, {"compress": true}), (err) => {
|
|
if(err !== null) {
|
|
console.log(err);
|
|
}
|
|
});
|
|
});
|
|
});
|