aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

Type attribute stripped from input tags #138

Closed jdposthuma closed 7 years ago

jdposthuma commented 8 years ago

app/src/components/list-control-search.html: ...<input type="text" value.bind="filter & debounce:1000" placeholder='ie: "name: intterra"' />...

app/dist/components/list-control-search.html: ...<input type="text" value.bind="filter & debounce:1000" placeholder='ie: "name: intterra"' />...

app/dist/app-build.js: ...<input value.bind="filter & debounce:1000" placeholder=\'ie: "name: intterra"\'>...

Everything else in the bundle is working great. I feel like I'm taking crazy pills:)

EisenbergEffect commented 7 years ago

Are you using the jspm bundling system? If so, it has an HTML minifier. My guess is that the default settings remove the type if it is a type=text because that would be the default. You can change that. @ahmedshuhel Can you confirm?

ahmedshuhel commented 7 years ago

Here is the default list of options we use for minifying html. Only removeEmptyAttributes: true, is closer to this bug. But, it should only remove empty attributes and not the type="text" as this is not empty. I'll have to dig into html minifier docs to see if they enables this stripping by default or not. In the mean time, as @EisenbergEffect suggested you can override any defaults if you want by using options.htmlminopts : { all_options_that_html_minifier_support }

Here is a list of options html-minifier supoorts. https://github.com/kangax/html-minifier#options-quick-reference

ahmedshuhel commented 7 years ago

@jdposthuma @EisenbergEffect only removeRedundantAttributes option can cause this. According to html-minifier docs it's false by default and we haven't enabled it either. @jdposthuma Could you try explicitly disabling this in options.htmlminopts and see how it goes?

jp7677 commented 7 years ago

Please note that html minification actually never happens in version 0.4 due to https://github.com/aurelia/bundler/pull/146.

ahmedshuhel commented 7 years ago

Added removeRedundantAttributes: false default option.