Closed cjweigle closed 6 years ago
@chronweigle Sorry for the delay. I'm quite busy recently. Looking into the case now.
@chronweigle I'm a bit confused about the example. A little more complex one like:
{/*
// #!if SAY_WORLD
*/}
World!
{/*
// #!else
*/}
World2!
{/*
// #!endif
*/}
When SAY_WORLD
is true, yields:
{/*
*/}
World!
{/*
*/}
which looks odd and verbose, but still works. The whole file is proceeded line by line, split by \n
. So the \s
part in the regex should not match anything across the current line.
To solve the problem, I have made a new update to support new syntax like:
{/* #!if HELLO_WORLD */}
Hello World!
{/* #!endif */}
OR
/* #!if HELLO_WORLD */
Hello World!
/* #!endif */
See commit 0e44f43 for code changes and new tests.
@chronweigle Hi, checkout v1.0.4 to see if it works :smiley:
Works like a charm, thank you
Hello. You've made a great plugin. It's exactly what I needed. Thank you.
When preprocessing a project using react, adding a conditional block inside of a jsx expression causes a syntax error. The closing brace of the jsx comment gets removed with the block. Ignoring newline characters in the regex prevents this from happening.
Example Usage: