Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect file paths being logged when trying to validate .mjml files via glob #2421

Open
pdehaan opened this issue Feb 3, 2022 · 2 comments

Comments

@pdehaan
Copy link

pdehaan commented Feb 3, 2022

Describe the bug
Incorrect file paths being logged when trying to validate .mjml files via glob

To Reproduce
Steps to reproduce the behavior:

Create a index.mjml file in a nested directory (./foo/bar/baz/index.mjml):

<%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/. %>

<mj-section>
  <mj-column>
    <mj-text css-class="text-header">
      <span data-l10n-id="verifyLoginCode-title">Is this you signing up?</span>
    </mj-text>
  </mj-column>
</mj-section>

<%- include('/partials/location/index.mjml') %>

<mj-section>
  <mj-column>
    <mj-text css-class="text-body">
      <span data-l10n-id="verifyLoginCode-prompt">
        If yes, use this verification code in your registration form:
      </span>
    </mj-text>

    <mj-text css-class="code-large"><%- code %></mj-text>

    <mj-text css-class="text-body-no-margin">
      <span data-l10n-id="verifyLoginCode-expiry-notice">It expires in 5 minutes.</span>
    </mj-text>
  </mj-column>
</mj-section>

<%- include('/partials/automatedEmailChangePassword/index.mjml') %>
pwd # /tmp/mjml-validate-test
tree foo/

foo/
└── bar/
    └── baz/
        └── index.mjml

## OR
find foo -type f # foo/bar/baz/index.mjml

Now, if I run npx mjml --validate "foo/**/*.mjml" in my root directory (/tmp/mjml-validate-test), I get the following validation errors:

Line 1 of /private/tmp/mjml-validate-test/foo/bar/baz/foo/bar/baz/index.mjml (%#) — Element %# doesn't exist or is not registered
Line 13 of /private/tmp/mjml-validate-test/foo/bar/baz/foo/bar/baz/index.mjml (%-) — Element %- doesn't exist or is not registered
Line 31 of /private/tmp/mjml-validate-test/foo/bar/baz/foo/bar/baz/index.mjml (%-) — Element %- doesn't exist or is not registered

Command line error:
Validation failed

Expected behavior

/private/tmp/mjml-validate-test/foo/bar/baz/index.mjml

Actual behavior

/private/tmp/mjml-validate-test/foo/bar/baz/foo/bar/baz/index.mjml

Note how the "/foo/bar/baz/" file path part seems to be duplicated.

-/private/tmp/mjml-validate-test/foo/bar/baz/foo/bar/baz/index.mjml
+/private/tmp/mjml-validate-test/foo/bar/baz/index.mjml

MJML environment (please complete the following information):

  • OS: macOS
  • MJML Version: 4.12.0
  • MJML tool used: CLI
npx mjml --version
# mjml-core: 4.12.0
# mjml-cli: 4.12.0

Email sending environment(for rendering issues):

  • Platform used to send the email [e.g Putsmail]

Affected email clients (for rendering issues):

  • Email Client [e.g Gmail]
  • OS: [e.g. Windows]
  • Browser [e.g. Google Chrome]

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@pdehaan
Copy link
Author

pdehaan commented Feb 3, 2022

Unfortunately, I don't know enough about mjml yet to know if <%- include('/partials/location/index.mjml') %> syntax is valid or if we're doing some pre/post processing internally, but that seems to explain these validator errors:

(%#) — Element %# doesn't exist or is not registered
(%-) — Element %- doesn't exist or is not registered
(%-) — Element %- doesn't exist or is not registered

@iRyusa
Copy link
Member

iRyusa commented Feb 7, 2022

<%- include('/partials/location/index.mjml') %> is not a MJML include (it's weird that the regexp does grab them tho)
cc @kmcb777 can you check if we didn't broke something while updating the watch ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants