-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Create and register custom components #56
Comments
That's a good point Renato. I'm curious how that might be done. I know that if you run mjml in isolation, you can still import the content / partials, as long as the versions are the same. In theory you could import a deprecated mjml product into a ruby environment but it might give you compatibility warnings during compilation. I need to actually try this myself, but once the controller in rails is set to run and compile mjml, you should be able to build a custom component, add any extra settings into your controller, and voila. All rails needs is to register where this formerly isolated component, is residing. There was a discussion at some point, on building a controller that simply detects all the files within the mjml rails structure and works with them, even if you imported custom components. As long as they paths matched your setup. Cheers, |
@renatodeleao @Renjaminino I've never needed to build my own custom components, so I'm not going to be much help. But look forward to your pull request. |
@Renjaminino thanks for the reply. @sighmon here's some extra info. Again not the most avid Rails/ruby dev so take this with a pinch of salt, but I don't see this belonging the controller responsability. What i meant with So let's picture this:
A yet untested assumption on how to make it workThere might be an // .mjmlconfig
{
packages: [
"path/to/my-mjml-components/mj-insland.js"
]
} So apparently we can pass a custom config file The option available to the CLI is
AssumptionSo i assume that maybe it's possible to feed our mjml BIN with custom components, judging by this line of code Line 38 in c7f5b24
Which could become # removed the beautify options for brevity, we can merge them with the config file
command = "#{mjml_bin} -r #{in_tmp_file} -o #{out_tmp_file.path} --config.mjmlConfigPath #{configPath}" #initalizers/mjml.rb
Mjml.setup do |config|
config.configPath = "#{Rails.root}/.mjmlconfig" # or an hash directly?
end Now, the question for you guys: how delusional am I? 😅 I'll try to do a couple of tests myself, if I find that i'm crazy i'll come here and say sorry for wasting your time, if not i'll try to make a PR. Cheers, |
Heys! thanks to the community for the work on this 🙏
This is a question, more than an issue. I was wondering how can we register
mjml
custom components using this setup?I know that since we're in rails and have proper templating, we can just code custom component as
partials
, but i'm thinking on situation where the components are built in isolation elsewhere (as module), installed vianpm/yarn
and then imported, registered and ready to be used.Let me know if this makes any sense.
Cheers ☮️
R.
(not the brightest ruby/rails dev here)
The text was updated successfully, but these errors were encountered: