Closed bjoerge closed 10 years ago
The diff seems to be a bit messed up, which is making this tricky to review. I also think it looks like you've got your arrays vs. strings mixed up a little. modules
is an array, so won't work if you pass it to path.resolve
. Also, all paths should already be resolved before they get to the precompile function since they get resolved in index.js. Another thing I noted is that the documentation seems to suggest you can pass a string when using it for a folder but the folder code seems to assume it's an array.
Yeah, line endings got messed up. Sorry about that. I've fixed it now.
About string vs array in the configuration option: Since options.precompile
is passed through arrayify in settings.normalize
, (like settings.noParse
, etc), it should work both with strings and arrays.
It will also work with booleans for modules and files since using precompile: true
will be normalized to [true]
(which is just checked for truthyness later on). At the same time, passing false to arrayify will be normalized to false, so that will work too. This may be a little bit too coincidental so I'm fine with changing it into something more clear & obvious.
Removed call to path.resolve, thanks for pointing out !
Closing this in favour of #44
Here's a suggested fix for #31 / #32
Introduced a
precompile
setting that can be set according to the version (directory, file or modules):This is how to use it:
A few things to consider:
precompile
option is ignored if!settings.cache
Any suggestions/improvements are welcome :-)