Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function read_style(parser: Parser, start: number, attributes: Node[]) {
const content_start = parser.index;
const styles = parser.read_until(/<\/style>/);
const content_end = parser.index;
let ast;
try {
ast = parse(styles, {
positions: true,
offset: content_start,
});
} catch (err) {
if (err.name === 'CssSyntaxError') {
parser.error({
code: `css-syntax-error`,
message: err.message
}, err.offset);
} else {
throw err;
}
}
ast = JSON.parse(JSON.stringify(ast));
export default function read_style(parser: Parser, start: number, attributes: Node[]): Style {
const content_start = parser.index;
const styles = parser.read_until(/<\/style>/);
const content_end = parser.index;
let ast;
try {
ast = parse(styles, {
positions: true,
offset: content_start,
});
} catch (err) {
if (err.name === 'CssSyntaxError') {
parser.error({
code: `css-syntax-error`,
message: err.message
}, err.offset);
} else {
throw err;
}
}
ast = JSON.parse(JSON.stringify(ast));