0

I am trying to generate some react html but strange spaces are inserted breaking the html.

Please help!!!!

using the base template

running with command pgen exec pg-generator-templates/react-crud-template/ -d convectorFeathersServer -u postgres -p postgres -t src/react-crud-build

my template file :

<!doctype html>
<html lang="en">
  <head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
<title>React App</title>
</head>
<body>
<div id="root"></div>
<script src="bundle.js"></script>
</body>

the result

< !doctype html >
    <
    html lang = "en" >
    <
    head >
    <
    meta charset = "utf-8" >
    <
    meta name = "viewport"
content = "width=device-width, initial-scale=1" >
    <
    link rel = "stylesheet"
href = "https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css" >
    <
    title > React App < /title> <
    /head> <
    body >
    <
    div id = "root" > < /div>
    <
    script src = "bundle.js" > < /script> <
    /body> <
    /html>
fedevela
  • 41
  • 1
  • 6

1 Answers1

0

https://github.com/ozum/pg-generator/issues/30

ozum commented 2 hours ago Hi,

That's strange. Maybe js-beautify used by pg-generator could be reason.

Could you please comment line 119 - 121 of lib/index.js

   if (path.extname(target) === '.js' || path.extname(target) === '.html') {
        content         = beautify(content, this.beautyOptions);
    }
  // if (path.extname(target) === '.js' || path.extname(target) === '.html') {
  //      content         = beautify(content, this.beautyOptions);
  //  }

content in that function is generated text to be written to file. Please report result back, so I can figure something to fix that.

fedevela
  • 41
  • 1
  • 6