jsoverson / preprocess

Preprocess HTML, JavaScript, and other files with directives based off custom or ENV configuration
Other
366 stars 80 forks source link

Static preprocess directive #52

Closed BendingBender closed 9 years ago

BendingBender commented 9 years ago

I had a problem with the @include directive including a css file into an html file that contained an inlined, base64-encoded font. The CSS file itself was ~270kb and the preprocessing took for about a minute!

I could track this misbehavior down to the fact that @include applies all possible RegExps (for a file type) after including it, recursively. And for this kind of a file, the RegExp engine seems to take quite a long time to process all of them.

As a workaround, I've implemented the @static-include directive. It works the same way as @include but doesn't process the included file recursively.

I intentionally didn't edit the changelog because I don't know what version number you'll give to the lib in case you accept my PR.