2021-06-09 07:33:36 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
const fs = require("fs");
|
|
|
|
const css = require("css");
|
|
|
|
|
2021-06-10 08:41:10 +00:00
|
|
|
fs.readFile("/app/setup/chromecast.css", "utf-8", (err, a) => {
|
2021-06-09 13:01:19 +00:00
|
|
|
let data = "";
|
|
|
|
if(err === null) {
|
2021-06-10 08:41:10 +00:00
|
|
|
try {
|
|
|
|
let ast = css.parse(a);
|
|
|
|
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);
|
|
|
|
}
|
2021-06-09 13:01:19 +00:00
|
|
|
}
|
2021-06-10 08:41:10 +00:00
|
|
|
rule.declarations = decls;
|
2021-06-09 07:33:36 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-10 08:41:10 +00:00
|
|
|
data = css.stringify(ast);
|
|
|
|
} catch(e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fs.readFile("/app/style.css", "utf-8", (err, b) => {
|
|
|
|
if(err === null) {
|
|
|
|
data = b + "\n" + data + "\n";
|
2021-06-09 07:33:36 +00:00
|
|
|
}
|
2021-06-10 08:41:10 +00:00
|
|
|
fs.writeFile("/app/style.css", css.stringify(css.parse(data), {"compress": true}), (err) => {
|
2021-06-09 13:01:19 +00:00
|
|
|
if(err !== null) {
|
|
|
|
console.log(err);
|
|
|
|
}
|
|
|
|
});
|
2021-06-09 07:33:36 +00:00
|
|
|
});
|
|
|
|
});
|