Comments (4)
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.
mjmlio/mjml@1ee581f looks possibly relevant... :-\
from mjml-rails.
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.
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)
- Update GitHub actions
- [Bug] Does not find MJML executable with npm 9+ (yarn 2+ uses npm discovery) HOT 2
- Slow to render layout, and too much object(memory) Allocations HOT 1
- Prevents booting when `which` is missing HOT 8
- Can i override a layout? HOT 1
- How to custom template path? HOT 1
- Add config option for fonts HOT 1
- Fix test pipeline for Ruby 2.7
- Warning about MJML missing when using MRML HOT 5
- Database template support HOT 1
- What node packages need to make it working properly? HOT 1
- unable to load included template when using MRML HOT 3
- Support JSON MJML templates HOT 1
- Support variables as used in Mailjet HOT 6
- Fix tests
- RuboCop? HOT 2
- `Mjml::Parser#render` suppresses errors in case of Tempfile exceptions HOT 2
- Exit code in case of an error when calling the mjml binary HOT 3
- SIGKILL (signal 9) on many concurrent emails HOT 3
- How to use this library to generate a string of raw html? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mjml-rails.