The documentation includes a live playground where you can try out the syntax. The plugin then processes the code to the valid CSS equivalent similar to what’s shown in the first code block. You essentially draw your website’s layout using ASCII characters as a value of the grid-kiss property. The key part of the JavaScript is this: body : JSON. But it’s a simple way to demonstrate how Jam API works. Of course, this example is pointless because the CSS Values website does this already. See the Pen Using Jam API to fetch CSS Data from by SitePoint ( on CodePen. Using that example, I was able to build a simple tool to let you display the possible values for any CSS property, which is scraped from my CSS Values website. For our purposes, I’ll expand on the JavaScript example they provide on their GitHub repo. The code will vary depending on if you’re using Node, Ruby, etc. To use the API, you execute a POST request to the Jam API website, sending the URL of the website you want to scrape. It’s described as “a service that allows you to turn any site into a JSON accessible API using CSS selectors.” So it’s a tool that lets you scrape content – but the CSS part really makes it interesting for front-end devs. This web service could come in handy for a number of different things, not necessarily only related to front-end development. I also tested it in v2.0 and Modaal is supposed to work with jQuery 1.11.2 and above. My CodePen demo above is using jQuery 3.1.1. The only major drawback to using Modaal is the fact that it currently has jQuery as a dependency and it doesn’t work with jQuery’s slim build. See the Pen Modaal Window Examples using Modaal by SitePoint ( on CodePen. it closes when you hit ESC, among other things), it’s WCAG 2.0 Level AA accessible, accepts virtually all types of content, has full-screen support, offers callback events for before/after open and close, and lots more.īelow is a CodePen demo I whipped up to demonstrate how it can be used. ![]() This modal window behaves exactly as it’s supposed to behave – it’s responsive, it functions correctly based on user interaction (e.g. It’s not difficult to find a modal window plugin, but it’s rare to find one that checks almost all the boxes in terms of functionality and features. Head over the Community Slack to meet fellow MJML'ers.It always feels like tools featuring accessibility tend to go unappreciated in our industry, so the first one I’m including here is this flexible and easy-to-use modal window plugin. ![]() MJML wouldn't be as cool without its amazing community. Head over here to learn more about the API. APIĪ free-to-use MJML API is available to make it easy to integrate MJML in your application. This js file needs to export an Object with the same structure as a standard JSON. ![]() Note that it's also possible to define preprocessors in your mjmlconfig file. mjmlconfig file (for custom components use)Īllows to use the options attribute from. Options for html minifier, see mjml-cli documentation for more info Preserve some tags when inlining css, see mjml-cli documentation for more info Functions must be (xml: string) => string Preprocessors applied to the xml before parsing. Path of file, used for relative paths in mj-includes Option to keep comments in the HTML outputĪvailable values for the validator: 'strict', 'soft', 'skip' You can pass optional options as an object to the mjml2html function: optionĭefault fonts imported in the HTML rendered by MJML Import mjml2html from 'mjml' /* Compile an mjml string */ const htmlOutput = mjml2html ( ` Hello World! `, options ) /* Print the responsive HTML generated and MJML errors if any */ console.
0 Comments
Leave a Reply. |