Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
root.walkAtRules('mixin', (atRule) => {
const { params } = atRule;
const selector = mixinParamsToFunc(params);
let contents = '';
postcssScss.stringify(atRule, (string, node, startOrEnd) => {
// if node.type === decl skip when doing this above
// stops first and last part entering the string e.g "@mixin ad-exact($width, $height) {"
if (node && node === atRule && startOrEnd) return;
contents += string;
});
let isUsedInFile = false;
// search to see if mixin is used in file
root.walkAtRules('include', (rule) => {
if (rule.originalParams.split('(')[0] === params.split('(')[0]) {
isUsedInFile = true;
}
});
output.classes.set(selector, {
}
if (
checkUpTree(
rule,
nodeToCheck => nodeToCheck.type === 'atrule' && nodeToCheck.name === 'mixin',
)
) return;
if (rule.contentsAlreadyPrinted) {
return;
}
let contents = '';
postcssScss.stringify(rule, (string, node, startOrEnd) => {
if (node && node === rule && startOrEnd) return;
// asumption here is that there is some state involved
// e.g &:hover or &.is-selected.
const nestedInAmpersand = node
&& checkUpTree(
node,
nodeToCheck => nodeToCheck.type === 'rule' && nodeToCheck.selector.startsWith('&'),
);
if (node && isPlaceHolder) {
node.contentsAlreadyPrinted = true;
}
// ref class if nested in ampersand
if (