Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
[].push.apply(mdBodyProps, el.declarations);
return false;
}
}
return el.declarations && el.declarations.length !== 0;
});
// Merge `.markdown-body` rules
style.stylesheet.rules.unshift({
type: 'rule',
selectors: ['.markdown-body'],
declarations: mdBodyProps
});
return css.stringify(style);
};
stylesheets.forEach((stylesheet) => {
try {
const css = cssParser.parse(stylesheet.innerText)
Object.values(css.stylesheet.rules)
.forEach((rule) => {
if (rule.type === 'rule') {
rule.selectors = stripAndAddScope(rule.selectors) // eslint-disable-line
} else if (rule.type === 'media') {
rule.rules.forEach((r) => {
r.selectors = stripAndAddScope(r.selectors) // eslint-disable-line
})
}
})
stylesheet.innerText = cssParser.stringify(css, { compress: true }) // eslint-disable-line
} catch (e) {
stylesheet.innerText = '' // eslint-disable-line
}
})
const sScopeSelector = "." + sScopeName;
const oScope = scope(oDiff.diff, sScopeSelector);
let oCssScopeRoot;
if (oDiff.stack) {
oCssScopeRoot = scope.scopeCssRoot(oDiff.stack.stylesheet.rules, sScopeName);
if (oCssScopeRoot) {
oScope.stylesheet.rules.unshift(oCssScopeRoot);
}
}
// Append scope + stack to embeddedCompareFile (actually target file, which is currently always the same i.e. "library.css")
// The stack gets appended to the embeddedFile only
let sAppend = css.stringify(oScope, {
compress: options.compiler && options.compiler.compress === true
});
if (scopeOptions.baseFilePath !== options.lessInputPath && oDiff.stack && oDiff.stack.stylesheet.rules.length > 0) {
sAppend += "\n" + css.stringify(oDiff.stack, {
compress: options.compiler && options.compiler.compress === true
});
}
return sAppend + "\n";
}
it('replace import「double quotes」', () => {
const code = '@import \"./sign/save.wxss\";\n';
const stylesheet = parse(code, {});
replaceImport(CssType.wxss, CssType.acss, stylesheet);
const result = stringify(stylesheet, { indent: ' ' });
expect(result).to.equal('@import "./sign/save.acss";');
})
type: 'rule',
selectors: [':root'],
declarations: [commentTitle, ...declarationsBody],
},
],
parsingErrors: [],
},
};
fs.writeFileSync(
path.join(
__dirname,
'../../../',
'packages-shared/ui-kit/materials/colors/colors.mod.css'
),
css.stringify(AST),
'utf-8'
);
.map((styleSheet) => css.stringify(styleSheet))
.map((cssString) => `${msg}:\n${indent(cssString)}`)
function result () {
return css.stringify(sheet) + '\n';
}
}
function flip(str, options) {
var ast = css.parse(str, options);
flipNode(ast.stylesheet);
return css.stringify(ast, options);
}
function readCSS(path) {
return css.stringify(css.parse(read(path)), { compress: true });
}
function write(path, src) {
rule.selectors =
selectors.
map(function (sel) {
return sel.
replace(
CLASSNAME_OR_ID_SELECTOR_REGEX,
function (match, pre, post) {
var newname = pre + opts.prefix + post;
opts.cache[post] = newname;
return newname;
}
);
});
});
return css.stringify(ast, { compress: true });
}