mde / ejs

Embedded JavaScript templates -- http://ejs.co
Apache License 2.0
7.76k stars 842 forks source link

How is the order of attributes sorted in EJS? #612

Closed hiroya-uga closed 3 years ago

hiroya-uga commented 3 years ago

In my project, we are using CI to automatically build EJS and deploy.

One day, my team staff noticed that there were many differences that were not expected in builded HTML files. The reason of that cause was a difference in the attribute order of the img elements.

Why these differences?

<a href="___dummy__" class="value">
<img src="/path/to/image.svg" alt="value" width="100" height="40" class="value">
<!-- /.value --></a>

<a href="___dummy__" class="value">
<img src="/path/to/image.svg" height="40" alt="value" width="100" class="value">
<!-- /.value --></a>

We use npm ci with package-lock.json.

    "gulp-ejs": {
      "version": "5.1.0",
      "resolved": "https://registry.npmjs.org/gulp-ejs/-/gulp-ejs-5.1.0.tgz",
      "integrity": "sha512-Nygek+aV5+Fk8pneX8ztR6XqWuOp19AglVJ+qpIxPzyx/qsN8HHtroi3yiKhFDCDblIGhKcbmPonBEOB8NYbZQ==",
      "dev": true,
      "requires": {
        "ejs": "^3.0.1",
        "plugin-error": "^1.0.0",
        "through2": "^3.0.1"
      },
      "dependencies": {
        "through2": {
          "version": "3.0.2",
          "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
          "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
          "dev": true,
          "requires": {
            "inherits": "^2.0.4",
            "readable-stream": "2 || 3"
          }
        }
      }
    },

...

    "ejs": {
      "version": "3.1.3",
      "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.3.tgz",
      "integrity": "sha512-wmtrUGyfSC23GC/B1SMv2ogAUgbQEtDmTIhfqielrG5ExIM9TP4UoYdi90jLF1aTcsWCJNEO0UrgKzP0y3nTSg==",
      "dev": true,
      "requires": {
        "jake": "^10.6.1"
      }
    },

thank you

hiroya-uga commented 3 years ago

I'm so sorry. I didn't check enough.

I'm sure this is the work of gulp-html-minifier, and since I understand that EJS is not the cause, I'll close this Issue.