Mjml: Element mj-include doesn't exist or is not registered

Created on 25 Apr 2017  Â·  8Comments  Â·  Source: mjmlio/mjml

I am using mjml 3.3.0 and I am getting this error when validating the mjml syntax.

I get this error after running mjml --validate src/templates/*.mjml command:

Line 9 (mj-include) — Element mj-include doesn't exist or is not registered
Line 57 (mj-include) — Element mj-include doesn't exist or is not registered

I have fixed the rendering issue (https://github.com/mjmlio/mjml/issues/542) by giving filePath parameter to mjml2html, so the files are rendered ok, but the validation fails.

Validation

Most helpful comment

Hey there,

But is it possible to config validator and disable that rule? My validation test fails if any messages are returned, so I cannot use this native functionality in CI scripts.

All 8 comments

Hello @eddjoke

Sorry for that, but mjml --validate doesn't support mj-include. I agree that the error isn't really clear about it, it should say that it can't validate any mj-included file yet.

Hey there,

But is it possible to config validator and disable that rule? My validation test fails if any messages are returned, so I cannot use this native functionality in CI scripts.

Can you say if your code is written without spaces in the attribute assignment?
I started to use Visual Studio's Align extension to visually align the attributes, and it complained on the mj-include 'path'. Didn't even compiled the included file.

I use Align to get code like this, just so that is becomes more easy on the eye:

  <mj-section
      background-color   = "#f0f0f0"
      padding-top        = "0"
      padding-bottom     = "0">

      <mj-column >
          <mj-image
              href       = "somepath"
              src        = "someotherpath" />
      </mj-column>
  </mj-section>

  <mj-include
       path              = "../whatever_path" />

I had no problems with this, except the \

<mj-include path="../whatever_path" />

Could it be that?

Hi @urbgimtam

My code is written without any additional whitespaces. I always trying to keep code neat and tidy.

You may still have the same problem, since as @iRyusa said that mjml --validate doesn't support mj-include, but I would like mjml validator to be fully customisable.

Yep, totally agree: couldn't we just disable this error message?
When I'm editing my emails, I always have this tooltip showing and it becomes very irritating (it hides the bottom line).

tooltip

In MJML4, we're now supporting nested validation through include so it won't happens.

What's your editor @nagman it shouldn't behave like that ?

I'm using Atom with the language-mjml and linter-mjml plugins

Thanks for reporting. This is now fixed in MJML 4.0.0-beta.2 so I'm closing!

Please upgrade with npm install mjml@next to use the latest beta.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zarikadzer picture zarikadzer  Â·  3Comments

csmcanarney picture csmcanarney  Â·  3Comments

liminspace picture liminspace  Â·  3Comments

plaisted picture plaisted  Â·  4Comments

kytosai picture kytosai  Â·  4Comments