Insufficient linefeed detection
The current approach to detect the linefeed via a regex leads to problems when you have files where the line endings are mixed up (of cause that shouldn't be the case, but can happen). This leads to problems when replacing the code blocks, where they are not getted replaced and finding that bug was really hard.
In the current version the linefeed is only used for rejoining the extracted code blocks. There should be no need for the rejoining when simply reusing the extracted codeblock for replacing.
Agreed. To be reviewed for v2.0
Is this the same as or related to #44?
I suggest also adding a test cases to usemin:
- HTML is all on one long line
- HTML that been minified (but is still structurally correct)
- HTML with extra whitespace in various odd places
- HTML with various silly kinds of newlines.
:thumbsup: @kylecordes use cases. The first one is my default use case (jade and auto-minification)
Jade and minification is how we prepare production content also. Workaround:
- Make Jade emit pretty printed HTML, which fits usemin's idea of how HTML should look very nicely.
- usemin.
- Minify the HTML afterward.
Any updates on this?
At the risk of being "that guy", I would like to point whoever might work on this in the direction of the following classic Stack Overflow page. It answers the question of whether a regex is a workable tool to parse HTML.
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
short answer: no, regex is not in any way suitable to parse HTML.
Related to #244 (HTML parsing) and #416 (Linefeed detection for replacing blocks)