Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
color = getColor(decl);
// Extract color to background-color propery
if (color && color.length === 1) {
declaration = postcss.decl({
prop: 'background-color',
value: color[0]
});
declaration.raws.before = ' ';
rule.append(declaration);
}
}
if (decl.prop === BACKGROUND || decl.prop === BACKGROUND_IMAGE) {
image.token = postcss.comment({
text: image.url,
});
image.token.raws.before = ' ';
image.token.raws.left = '@replace|';
image.token.raws.right = '';
// Replace the declaration with a comment token
// which will be used later for reference.
decl.replaceWith(image.token);
}
}
}
});
comment (node, parent, inline) {
// https://github.com/nodesecurity/eslint-plugin-security#detect-unsafe-regex
// eslint-disable-next-line security/detect-unsafe-regex
let text = node.content.match(/^(\s*)((?:\S[\S\s]*?)?)(\s*)$/)
this.raws.comment = true
let comment = Object.assign(postcss.comment(), {
text: text[2],
raws: {
before: this.raws.before || DEFAULT_COMMENT_DECL.before,
left: text[1],
right: text[3],
inline
},
source: {
start: {
line: node.start.line,
column: node.start.column
},
end: node.end,
input: this.input
},
parent
comment (node, parent) {
if (!parent.nodes || (node.start < parent.raws.node.start && parent.type !== "root" && parent.parent)) {
return this.comment(node, parent.parent);
}
const text = node.value.match(/^(\s*)((?:\S[\s\S]*?)?)(\s*)$/);
const comment = postcss.comment({
text: text[2],
raws: {
node,
left: text[1],
right: text[3],
inline: node.type === "CommentLine",
},
});
parent.push(comment);
return comment;
}
}
comment (node, parent) {
if (!parent.nodes || (node.start < parent.raws.node.start && parent.type !== "root" && parent.parent)) {
return this.comment(node, parent.parent);
}
const text = node.value.match(/^(\s*)((?:\S[\s\S]*?)?)(\s*)$/);
const comment = postcss.comment({
text: text[2],
raws: {
node,
left: text[1],
right: text[3],
inline: node.type === "CommentLine",
},
});
parent.push(comment);
return comment;
}
}
css => {
css.insertBefore(css.nodes[0], postcss.comment({text: 'rtl:begin:rename'}));
css.insertAfter(css.nodes[css.nodes.length - 1], postcss.comment({text: 'rtl:end:rename'}));
},
rtlcss({
function setCommentToken(image) {
const imageObj = image;
imageObj.token = postcss.comment({
text: imageObj.url,
raws: {
before: ' ',
left: '@replace|',
right: '',
},
});
}
function createHelperRule() {
var rule = postcss.rule({
selector: helperSelector
});
rule.append(
postcss.comment({
text: 'If you can see this comment, you might have forgotten to add\n' +
'postcss-media-variables to the plugin list for a second time.\n\n' +
'Otherwise, it\'s a bug :) Sorry\n' +
'Please report here: https://github.com/WolfgangKluge/postcss-media-variables/issues'
})
);
return rule;
}