Merge pull request #254 from sveltejs/gh-252

handle multiline comments in CSS
pull/255/head
Rich Harris 8 years ago committed by GitHub
commit 8814460fae

@ -1,6 +1,6 @@
// largely borrowed from Ractive https://github.com/ractivejs/ractive/blob/2ec648aaf5296bb88c21812e947e0e42fcc456e3/src/Ractive/config/custom/css/transform.js
const selectorsPattern = /(?:^|\})?\s*([^\{\}]+)\s*\{/g;
const commentsPattern = /\/\*.*?\*\//g;
const commentsPattern = /\/\*[\s\S]*?\*\//g;
const selectorUnitPattern = /((?:(?:\[[^\]+]\])|(?:[^\s\+\>~:]))+)((?:::?[^\s\+\>\~\(:]+(?:\([^\)]+\))?)*\s*[\s\+\>\~]?)\s*/g;
const excludePattern = /^(?:@|\d+%)/;

@ -0,0 +1,7 @@
// JSDOM makes this test pass when it should fail. weird
export default {
test ( assert, component, target, window ) {
const p = target.querySelector( 'p' );
assert.equal( window.getComputedStyle( p ).color, 'red' );
}
};

@ -0,0 +1,11 @@
<p>red</p>
<style>
/*
div {}
*/
p {
color: red;
}
</style>
Loading…
Cancel
Save