Tell Webassets not to minify some code

68 views Asked by At

I am using Flask Assets which uses Webassets. It does a great job of stripping my HTML.

However it strips whitespace in one area where I do not want whitespace to be stripped. Is there a way to tell webassets not to strip the whitespace from one area of code?

1

There are 1 answers

0
greginvm On

If I understand you correctly, you want to prevent webassets to strip spaces only from a part of a file that you are minifying. You can either implement your own filter (or inherit the one you use now) and mark the area with some custom tags and leave that out for stripping OR you could use the non-breaking space code ( ) instead of spaces (" ") in that part of the HTML (though it has a slightly different behavior, check if that complies your use-case) instead of spaces. In that case they wont be stripped. Check the other codes here.