vigour-io / postcssify

Browserify transform for postcss
ISC License
4 stars 1 forks source link

Ignore commented `require`s and `@import`s #18

Closed shawninder closed 8 years ago

shawninder commented 8 years ago

But finding comments with regular expressions can be rather difficult. Consider the following corner cases:

var str = 'This is /* not */ a comment'
var url = `http://nor.is/this`
var re = /still not \/* a comment*/

Indeed it may even be impossible since javascript is not a regular language (nor is CSS).

I think we're going to have to use parsers for this instead. I just hope it won't make things too slow...

shawninder commented 8 years ago

For javascript, in order to re-use the parsing already done by browserify, we would need to make a plugin, not a transform. I think I'm going to try both a plugin and transform and measure whether it's worth the sacrifice or not... Hopefully it's not that slow to re-parse, considering we don't do a full parse, just enough to get the requires (using detective)

shawninder commented 8 years ago

JS part is done (using detective)

Next up is the CSS part. I will probably create a css-detective using postcss to keep things consistent..

shawninder commented 8 years ago

css-detective