Coder Social home page Coder Social logo

Comments (12)

boxblinkracer avatar boxblinkracer commented on September 28, 2024 1

Hi

a perfect

thats amazing
so we have a
a) a new extension
b) new snippet pattern in that files

great

ill do it

thanks a lot :)

from phpunuhi.

boxblinkracer avatar boxblinkracer commented on September 28, 2024 1

you can test dev-master with the new scanner
should work now, QA not started yet but unit tests are all passing

from phpunuhi.

boxblinkracer avatar boxblinkracer commented on September 28, 2024 1

Hi

ok got it, stupid me. forgot to ask the scanner implementation what file extension to use
accidentally always used TWIG

now its dynamic and should work in dev-master :)

from phpunuhi.

wannevancamp avatar wannevancamp commented on September 28, 2024 1

Great, I've tested the fix on the dev-main and it works 👍

The last step to make the CI validation work is the compatibility for mjml with the validate:all command. I suppose it's better to create another ticket for this?

from phpunuhi.

boxblinkracer avatar boxblinkracer commented on September 28, 2024

hi

thanks for this great idea

so i think frosh also uses twig. that means snippets have a different syntax? or do you need same snippet twig syntax with a different file extension?

thanks

from phpunuhi.

wannevancamp avatar wannevancamp commented on September 28, 2024

The FroshPlatformTemplateMail plugin supports MJML formats which makes styling emails much easier. In those templates, the MJML extension is used instead of twig.

Example folder structure with MJML files.
lensonline-shop6-webshop – contact_form:html mjml 2024-01-23 07-57-37

MJML content with snippets.

<mjml>
    <mj-body mj-class="body">
        <mj-wrapper mj-class="body__wrapper">
            <mj-section mj-class="content">
                <mj-column>
                    <mj-text>
                        <h1>{{ 'email.contact.subject'|trans|sw_sanitize }}</h1>
                        <p>{{ 'email.contact.intro'|trans|sw_sanitize }}</p>

                        ...
                    </mj-text>
                </mj-column>
            </mj-section>
        </mj-wrapper>
    </mj-body>
</mjml>

In this example the snippets in the MJML file are not detected by the twig-scanner.

  • email.contact.subject
  • email.contact.intro

from phpunuhi.

wannevancamp avatar wannevancamp commented on September 28, 2024

Thanks for the fast response!

I've tested the feature on the dev-main branch but it still does not recognize the .mjml files? Do I have to activate to MJML-scanner?

#1 [EMPTY_CONTENT] Found empty translation
   - Locale: en-GB
   - File: /.../.../.../.../src/xyz/Resources/snippet/storefront.en-GB.json
   - Line: 30
       [x]: email.contact.intro

from phpunuhi.

boxblinkracer avatar boxblinkracer commented on September 28, 2024

you need to use the scanner:usage command
the detection in files is integrating with an external system from the frameworks point of view (so twig files)
and its not 100% correct...because snippets might not appear inside templates but could be used inside PHP scripts....

so the basic idea on scanners is to get some quick insight in what MIGHT not be used :)

php bin/console scanner:usage .... --scanner=mjml --dir=xyz

that should work

from phpunuhi.

wannevancamp avatar wannevancamp commented on September 28, 2024

I'm running php vendor/bin/phpunuhi scan:usage --dir=./src --scanner=mjml --set=General
but still get the following errors:

+-------+----------------------------------------------------+----------------------------------------------------------------------------------+
| #     | Keys (2)                                          | Error                                                                            |
+-------+----------------------------------------------------+----------------------------------------------------------------------------------+
| 1     | email.contact.intro                             | Key not found in any file                                                        |
| 2     | email.contact.subject                                | Key not found in any file                                                        |

This is my simplified configuration
image

from phpunuhi.

boxblinkracer avatar boxblinkracer commented on September 28, 2024

Ok that's funny because of these unit tests with the exact same data haha
https://github.com/boxblinkracer/phpunuhi/blob/main/tests/phpunit/Bundles/Scanner/MJML/MjmlScannerTest.php

could only think of the file not being found somehow

ill check it out...maybe ill add a debug output which files have been scanned
would be good right? or a verbose mode for that maybe?

from phpunuhi.

boxblinkracer avatar boxblinkracer commented on September 28, 2024

Hi
amazing thank you

yeah i didnt really want to add the scanners to the official validation command
because the result is not 100% valid....please see the warnings in the text

if snippets are added thru PHP for instance...then its okay that they are not found in those files.
so scanners are more some working helpers.....

do you have any better idea on that?

from phpunuhi.

boxblinkracer avatar boxblinkracer commented on September 28, 2024

released in 1.17.0

from phpunuhi.

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.