felixzapata / gulp-i18n-pug

Gulp plugin to compile Pug templates with internationalization support based on JS/JSON/YAML files
MIT License
28 stars 4 forks source link

HTML pretty option #9

Closed nOttenga closed 5 years ago

nOttenga commented 5 years ago

Hello,

first of all, thanks for the plugin, it really boosted my dev flow.

I was wondering if there is any way to avoid HTML minification, for example:

const options = {
    i18n: {
      dest: paths.html.dest,
      locales: paths.i18n.src,
      localeExtension: false,
      pretty: true                     // like this
    }
  }

i tried every way i could imagine but nothing.

PS i just discovered i can use the localization with pug's +mixins. Amazing.

felixzapata commented 5 years ago

hi @nOttenga you're welcome.

About your question, according with the pug options, the pretty option is deprecated:

pretty: boolean | string [Deprecated.] Adds whitespace to the resulting HTML to make it easier for a human to read using ' ' as indentation. If a string is specified, that will be used as indentation instead (e.g. '\t'). We strongly recommend against using this option. Too often, it creates subtle bugs in your templates because of the way it alters the interpretation and rendering of whitespace, and so this feature is going to be removed. Defaults to false.

nOttenga commented 5 years ago

Oh dang. I really liked that feature.

For now, I solved it with gulp-html-beautify after all the other tasks have resolved.

A little overkill I think, but it's the best I could manage to do.