gulp-posthtml
gulp-posthtml copied to clipboard
Malformed HTML generated
gulp-posthtml runs with no errors but generates malformed HTML only in Ubuntu
Details
I use gulp-posthtml in my Polymer project to strip the CSS from a component and apply autoprefixer, like this
...
.pipe(gulpif(/\.html$/, postHtml([postHtmlPostCss([autoprefixer('last 2 versions')])])))
...
On MacOS 10.13.2 everything works perfectly. But if I run exactly the same on a Jenkins setup I have detected that gulp-posthtml generates some malformed HTML:
The original part of the code (part of an iron-ajax call)
body='{"start":[[startingItem]], "count":[[itemsPerPage]], "query": "[[query]]"}'
The part of the code generated on MacOS (html works)
body="{"start":[[startingItem]], "count":[[itemsPerPage]], "query": "[[query]]"}"
The code generated by Jenkins (on an Ubuntu 16)
body="{" start":[[startingitem]],="" "count":[[itemsperpage]],="" "query":="" "[[query]]"}"=""
Notice the space added before start and the ="" in several positions
Environment
MacOS environment
| OS | node | npm/yarn | package |
|---|---|---|---|
| MacOS 10.13.2 | 8.10.0 | 5.6.0 | 3.0.0 |
Jenkins environment
| OS | node | npm/yarn | package |
|---|---|---|---|
| Ubuntu 16 | 8.10.0 | 5.6.0 | 3.0.0 |
@arnaumanyosa this is due to the incorrect operation of the parser which is used in posthtml-parser.
For now, it's better to escaped all incoming html data.