only filter remote css
This commit is contained in:
parent
1b5249daf3
commit
f04d343bdf
@ -3,30 +3,35 @@
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const css = require("css");
|
const css = require("css");
|
||||||
|
|
||||||
fs.readFile("/app/style.css", "utf-8", (err, a) => {
|
fs.readFile("/app/setup/chromecast.css", "utf-8", (err, a) => {
|
||||||
let data = "";
|
let data = "";
|
||||||
if(err === null) {
|
if(err === null) {
|
||||||
data = a + "\n";
|
try {
|
||||||
}
|
let ast = css.parse(a);
|
||||||
fs.readFile("/app/setup/chromecast.css", "utf-8", (err, b) => {
|
for(const rule of ast.stylesheet.rules) {
|
||||||
if(err === null) {
|
const decls = [];
|
||||||
data += b + "\n";
|
if(Symbol.iterator in Object(rule.declarations)) {
|
||||||
}
|
for(const decl of rule.declarations) {
|
||||||
const ast = css.parse(data);
|
const isNotUrl = !(decl.value.toLowerCase().startsWith("url"));
|
||||||
for(const rule of ast.stylesheet.rules) {
|
const isNotContent = !(decl.property.toLowerCase() == "content");
|
||||||
const decls = [];
|
if(isNotContent && isNotUrl) {
|
||||||
if(Symbol.iterator in Object(rule.declarations)) {
|
decls.push(decl);
|
||||||
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;
|
||||||
}
|
}
|
||||||
rule.declarations = decls;
|
|
||||||
}
|
}
|
||||||
|
data = css.stringify(ast);
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
}
|
}
|
||||||
fs.writeFile("/app/style.css", css.stringify(ast, {"compress": true}), (err) => {
|
}
|
||||||
|
fs.readFile("/app/style.css", "utf-8", (err, b) => {
|
||||||
|
if(err === null) {
|
||||||
|
data = b + "\n" + data + "\n";
|
||||||
|
}
|
||||||
|
console.log(data);
|
||||||
|
fs.writeFile("/app/style.css", css.stringify(css.parse(data), {"compress": true}), (err) => {
|
||||||
if(err !== null) {
|
if(err !== null) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user