Static GitHub Issues

[425] Generate valid html

prev: Got "Cannot read property 'url' of undefined" error when using .renderRoute
next: Use vuex helper functions

Hi,

I’d like to generate valid html output when in production… Actually there are 3 problems:

  • html attributes comes without spacing when minified → This isn’t allowed(http://www.w3.org/TR/html5/syntax.html#start-tags see point 4)
  • n-x attributes are used → html5 only allow custom attributes if they start by data-*. How can I change this settings? The html-head section of the doc show the custom attributes names, but don’t explain if it’s customisable, and how. Besides, there’s also a n-head-ssr in the default app.html
  • defer in scripts that are not loaded → a script tag is added at the end of the file, with the attribute defer, but it's only allowed if the attribute src="" is used; not on "containing" script tags. I think this is this in default app.html:
 <script type="text/javascript" defer>window.__NUXT__=<%= serialize(context.nuxt, { isJSON: true }) %></script>

For the first point, this is a webpack configuration to add, but maybe having simple options to switch in nuxt.config.js would be better? And with a default to not remove spaces? Actually, I couldn't find yet how to get this properly with the extend options.

The third point could be solved by using a custom Template, but once again, shouldn't an "out-of-the-box" code be valid in the first time?

Thanks for your help.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c369">#c369</a>)</em></sub></div>