Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
flow.css.packages.forEach(function(file){
fconsole.log(file.relOutputFilename);
// make a copy of ast, as it could has shared parts
// and csso optimizer might corrupt those parts
file.ast = csso.compress(copyAst(file.ast));
});
fconsole.endl();
fconsole.start('Process packages');
flow.css.packages.forEach(function(file){
fconsole.log(file.relOutputFilename);
// make a copy of ast, as it could has shared parts
// and csso optimizer might corrupt those parts
file.ast = csso.compress(copyAst(file.ast));
});
fconsole.endl();
fconsole.start('Process style attributes');
for (var i = 0, file; file = flow.files.queue[i]; i++)
if (file.type == 'style-block')
{
fconsole.log(file.relpath);
file.ast = csso.compress(
[{}, 'stylesheet', [{}, 'ruleset', [{}, 'selector', [{}, 'simpleselector', [{}, 'ident', 'rule']]],
file.ast
]])[2][3];
}
fconsole.end();
}).handlerName = '[css] Compress';
page = renderPage((App) => (props) => {
pageContext = props.pageContext
return sheet.collectStyles()
}
);
} else {
page = renderPage((App) => (props) =>
sheet.collectStyles(),
);
}
const styleTags = sheet.getStyleElement()
if (!phone) {
const css = pageContext.sheetsRegistry.toString()
const ast = csso.syntax.parse(css);
const compressedAst = csso.compress(ast).ast;
const minifiedCss = csso.syntax.generate(compressedAst);
return {
...page,
phone,
pageContext,
styleTags,
styles: (
const main = async (siteUrl: string, filePath) => {
const css = await getCss(siteUrl);
const ast = csso.syntax.parse(css[0].css);
const compressedAst = csso.compress(ast, {comments: false}).ast;
const minifiedCss = csso.syntax.generate(compressedAst);
const content = cssModule(minifiedCss);
await fs.writeFile(filePath, prettier.format(content, { singleQuote: true }));
console.log('success');
};
config.out.warn("Unknown URI type:", value);
continue;
}
value[1] = quote+rebase(uri, file, config)+quote;
}
for (var i = node.length - 1; i >= 0; i--) {
if (Array.isArray(node[i])) {
worklist.push(node[i]);
}
}
}
try {
ast = CSSO.compress(ast);
} catch (error) {
config.out.warn("CSS compression error: " + file.path);
config.out.warn(error.message);
}
try {
ast = CSSO.cleanInfo(ast);
} catch (error) {
config.out.warn("CSS clean info error: " + file.path);
config.out.warn(error.message);
}
return CSSO.translate(ast);
}
const compressCSS = async (file: string): Promise => {
const content = await fs.readFile(file, { encoding: 'utf8' });
const ast = csso.syntax.parse(content);
const compressedAst = csso.compress(ast, { comments: false }).ast;
return csso.syntax.generate(compressedAst);
};
config.out.warn("Unknown URI type:", value);
continue;
}
if (uri.indexOf(":") === -1) {
value[1] = quote + URL.resolve(base, uri) + quote;
}
}
for (i = node.length - 1; i >= 0; i--) {
if (Array.isArray(node[i])) {
worklist.push(node[i]);
}
}
}
}
try {
ast = CSSO.compress(ast);
} catch (error) {
config.out.warn("CSS compression error: ");
config.out.warn(error.message);
}
try {
ast = CSSO.cleanInfo(ast);
} catch (error) {
config.out.warn("CSS clean info error:");
config.out.warn(error.message);
}
return CSSO.translate(ast);
}
const compressCSS = async (file: string): Promise => {
const content = await fs.readFile(file, {encoding: 'utf8'});
const ast = csso.syntax.parse(content);
const compressedAst = csso.compress(ast, {comments: false}).ast;
return csso.syntax.generate(compressedAst);
};