Coder Social home page Coder Social logo

Comments (4)

denny avatar denny commented on September 26, 2024 1

I rewrote my validator to call out to mjml --validate directly, which solves the problem for me.

I'm going to close this issue as I feel like the validation/validator stuff is probably an edge case 🙂 If anybody else runs into a related problem then hopefully they'll find this and they can link/re-open.

I was wondering whether to try to add a .validate method alongside .render in Mjml::Parser (again, using mjml --validate to do the actual work). Let me know if that's a feature you'd like to add and I'll take a swing at it if I get time.

from mjml-rails.

denny avatar denny commented on September 26, 2024

mjmlio/mjml@1ee581f looks possibly relevant... :-\

from mjml-rails.

denny avatar denny commented on September 26, 2024

Definitely a change in how the mjml command responds to a partial input file 😒

denny@rocinante:~/ShinyCMS$ cat partial.mjml 
<mj-section>
  <mj-column>
    <mj-text>
      Hello world.
    </mj-text>
  </mj-column>
</mj-section>
denny@rocinante:~/ShinyCMS$ ./node_modules/.bin/mjml --version
mjml-core: 4.7.1
mjml-cli: 4.7.1
denny@rocinante:~/ShinyCMS$ ./node_modules/.bin/mjml -v partial.mjml 
denny@rocinante:~/ShinyCMS$ ./node_modules/.bin/mjml partial.mjml > /dev/null
denny@rocinante:~/ShinyCMS$ yarn install
yarn install v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 2.85s.
denny@rocinante:~/ShinyCMS$ ./node_modules/.bin/mjml --version
mjml-core: 4.8.0
mjml-cli: 4.8.0
denny@rocinante:~/ShinyCMS$ ./node_modules/.bin/mjml -v partial.mjml 
denny@rocinante:~/ShinyCMS$ ./node_modules/.bin/mjml partial.mjml > /dev/null
File: partial.mjml
TypeError: Cannot read property 'replace' of undefined

Command line error:
Input file(s) failed to render
denny@rocinante:~/ShinyCMS$ 

from mjml-rails.

denny avatar denny commented on September 26, 2024

Possibly interesting...

denny@rocinante:~/ShinyCMS$ cat invalid_partial.mjml
<mj-section>
  <mj-column>

     <mj-title>
      Titles don't belong in the body block
    </mj-title>

  </mj-column>
</mj-section>
denny@rocinante:~/ShinyCMS$ ./node_modules/.bin/mjml -v invalid_partial.mjml
Line 4 of /home/denny/code/denny/ShinyCMS-ruby/invalid_partial.mjml (mj-title) — mj-title cannot be used inside mj-column, only inside: mj-attributes, mj-head

Command line error:
Validation failed
denny@rocinante:~/ShinyCMS$ ./node_modules/.bin/mjml  invalid_partial.mjml > /dev/null
File: invalid_partial.mjml
TypeError: Cannot read property 'replace' of undefined

Command line error:
Input file(s) failed to render

... so the explicit validation option -v fails (with a useful error) if the MJML in a partial input file is actually invalid, but not if it's valid-but-incomplete. Is there any way for me to get at that behaviour through mjml-rails currently?

from mjml-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.