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

WIP: Experimental implementation for compiling email templates (usage from foundation for emails) #338

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

marvinhuebner
Copy link
Contributor

@marvinhuebner marvinhuebner commented Nov 9, 2018

First of all, I would like to say that I am aware that this adjustments probably will not be merged and we have to use our fork, but I want to open this PR anyway, in order to possibly trigger a discussion. Maybe that's also interesting for others.

This PR implements zurb/panini, zurb/inky and an inline-css plugin to basically use foundation for emails. The gulp tasks are adopted from zurb/foundation-emails-template.

With this toolset you're having the possibility to create your own email templates without the pain of writing html tables, because inky will provide syntactic sugar and will take convert your code to tables etc. See here: https://foundation.zurb.com/emails/docs/inky.html

I integrated the tasks into frontools to use the existing features like inheritance and the watcher. There are 2 new helper and 4 new tasks. The helper are inky and inliner and the tasks are inky, inliner, email (building emails for production with inliner), dev:email (tasks for developing email templates with watcher and browser sync for preview).

I've recorded a little example which will show how it's working: https://demo-frontools-email-wfttfpigcx.now.sh/

At the end I would like to say once again, that I'm aware that this will very likely not get merged. There are still some points that need to be solved, for example there is a pending patch for panini to get it working with absolute paths, i will do further testing and maybe fix some things and the readme needs to be adjusted do document the new tasks.

I think with the ideas for frontools 2.0 #201, it will be much easier to add something like this as a plugin.

And finally thanks for this great tool 🙏🏻, this makes developing magento 2 themes much more friendly. Without frontools, it's really cumbersome.

…mplates

Since handlebars also uses curly braces and the raw helper is often a bit awkward, a new template helper ({!! and !!}) is introduced, which gets replaced after handlebars is compiled  to the curly braces to be interpreted by magento.
Otherwise it would take only the options which are passed then creating the instance. But due the fact that there is the possibility to overwrite these files, it has to take the path from the current theme which gets compiled.
…to refresh the partials in all renderers

Panini exports an singleton, through that it holds all options and they can not be overwritten. This change adds a new panini instance for each task to hold it's own options.

Panini is patched because Handlebars is also a singleton, so the partials will be overwritten. You can find more infos here: foundation/panini#81 (comment)
@marvinhuebner
Copy link
Contributor Author

I've tried to fix the merge conflicts, but current master throws errors in babel task:

[22:20:38] gulp-notify: [Error running Gulp] Error: .presets must be an array, or undefined
[22:20:38] gulp-notify: [Error running Gulp] Error: .presets must be an array, or undefined
[22:20:38] gulp-notify: [Error running Gulp] Error: .presets must be an array, or undefined
[22:20:38] gulp-notify: [Error running Gulp] Error: .presets must be an array, or undefined
...

I think that comes from the update from gulp-babel. So I will not merge current master in this feature and will wait till this is fixed.

@Igloczek
Copy link
Contributor

@marvinhuebner master and develop are now in good shape, you can merge and test it.
I just keep temporarily on the master bunch of package upgrades, to make Greenkeeper happier 😄

@marvinhuebner
Copy link
Contributor Author

Hey @Igloczek,

thanks for the info, will test it soon!

I would be interested in your general opinion on a implementation like this. Do you see potential here?

Also, I would be interested if there are still ambitions for a v2 frontools, because if there would be a plugin system, that would certainly be perfect for something like this.

@Igloczek
Copy link
Contributor

TBH I didn't read it yet, will get into this as soon as I can.

Probably I'm not going to create Frontools V2. We are moving out of typical almost clean M2 projects into SPA / PWA oriented apps, so this tools will be in use mostly in existing projects, which means I will probably just maintain it, but not create anything new.

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

Successfully merging this pull request may close these issues.

2 participants