Skip to content

Commit b735d53

Browse files
authored
Merge pull request #3 from programmatordev/1.x
v0.2.0
2 parents ce32a84 + 34401f0 commit b735d53

4 files changed

Lines changed: 39 additions & 43 deletions

File tree

.ddev/config.yaml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,31 @@ disable_upload_dirs_warning: true
2020

2121
# name: <projectname> # Name of the project, automatically provides
2222
# http://projectname.ddev.site and https://projectname.ddev.site
23+
# If the name is omitted, the project will take the name of the enclosing directory,
24+
# which is useful if you want to have a copy of the project side by side with this one.
2325

2426
# type: <projecttype> # backdrop, cakephp, craftcms, drupal, drupal6, drupal7, drupal8, drupal9, drupal10, drupal11, generic, laravel, magento, magento2, php, shopware6, silverstripe, symfony, typo3, wordpress
25-
# See https://ddev.readthedocs.io/en/stable/users/quickstart/ for more
27+
# See https://docs.ddev.com/en/stable/users/quickstart/ for more
2628
# information on the different project types
2729

2830
# docroot: <relative_path> # Relative path to the directory containing index.php.
2931

30-
# php_version: "8.3" # PHP version to use, "5.6" through "8.4"
32+
# php_version: "8.3" # PHP version to use, "5.6" through "8.5"
3133

3234
# You can explicitly specify the webimage but this
3335
# is not recommended, as the images are often closely tied to DDEV's' behavior,
3436
# so this can break upgrades.
3537

36-
# webimage: <docker_image> # nginx/php docker image.
38+
# webimage: <docker_image>
39+
# It’s unusual to change this option, and we don’t recommend it without Docker experience and a good reason.
40+
# Typically, this means additions to the existing web image using a .ddev/web-build/Dockerfile.*
3741

3842
# database:
3943
# type: <dbtype> # mysql, mariadb, postgres
4044
# version: <version> # database version, like "10.11" or "8.0"
41-
# MariaDB versions can be 5.5-10.8, 10.11, and 11.4.
42-
# MySQL versions can be 5.5-8.0.
43-
# PostgreSQL versions can be 9-17.
45+
# MariaDB versions can be 5.5-10.8, 10.11, 11.4, 11.8
46+
# MySQL versions can be 5.5-8.0, 8.4
47+
# PostgreSQL versions can be 9-18
4448

4549
# router_http_port: <port> # Port to be used for http (defaults to global configuration, usually 80)
4650
# router_https_port: <port> # Port for https (defaults to global configuration, usually 443)
@@ -50,24 +54,16 @@ disable_upload_dirs_warning: true
5054
# "ddev xdebug" to enable Xdebug and "ddev xdebug off" to disable it work better,
5155
# as leaving Xdebug enabled all the time is a big performance hit.
5256

53-
# xhgui_https_port: 8142
54-
# Can be used to change the router https port for xhgui application
57+
# xhgui_http_port: "8143"
58+
# xhgui_https_port: "8142"
59+
# The XHGui ports can be changed from the default 8143 and 8142
5560
# Very rarely used
5661

57-
# xhgui_http_port: 8143
58-
# Can be used to change the router http port for xhgui application
59-
# Very rarely used
60-
61-
# host_xhgui_port: 8142
62-
# Can be used to change the host binding port of the xhgui
63-
# application. Rarely used; only when port conflict and
62+
# host_xhgui_port: "8142"
63+
# Can be used to change the host binding port of the XHGui
64+
# application. Rarely used; only when port conflict and
6465
# bind_all_ports is used (normally with router disabled)
6566

66-
# xhprof_enabled: false # Set to true to enable Xhprof and "ddev start" or "ddev restart"
67-
# Note that for most people the commands
68-
# "ddev xhprof" to enable Xhprof and "ddev xhprof off" to disable it work better,
69-
# as leaving Xhprof enabled all the time is a big performance hit.
70-
7167
# xhprof_mode: [prepend|xhgui|global]
7268
# Set to "xhgui" to enable XHGui features
7369
# "xhgui" will become default in a future major release
@@ -100,7 +96,7 @@ disable_upload_dirs_warning: true
10096

10197
# nodejs_version: "22"
10298
# change from the default system Node.js version to any other version.
103-
# See https://ddev.readthedocs.io/en/stable/users/configuration/config/#nodejs_version for more information
99+
# See https://docs.ddev.com/en/stable/users/configuration/config/#nodejs_version for more information
104100
# and https://www.npmjs.com/package/n#specifying-nodejs-versions for the full documentation,
105101
# Note that using of 'ddev nvm' is discouraged because "nodejs_version" is much easier to use,
106102
# can specify any version, and is more robust than using 'nvm'.
@@ -136,7 +132,7 @@ disable_upload_dirs_warning: true
136132

137133
# ddev_version_constraint: ""
138134
# Example:
139-
# ddev_version_constraint: ">= 1.22.4"
135+
# ddev_version_constraint: ">= 1.24.8"
140136
# This will enforce that the running ddev version is within this constraint.
141137
# See https://github.com/Masterminds/semver#checking-version-constraints for
142138
# supported constraint formats
@@ -165,8 +161,8 @@ disable_upload_dirs_warning: true
165161
# - "mutagen": enables Mutagen for this project.
166162
# - "nfs": enables NFS for this project.
167163
#
168-
# See https://ddev.readthedocs.io/en/stable/users/install/performance/#nfs
169-
# See https://ddev.readthedocs.io/en/stable/users/install/performance/#mutagen
164+
# See https://docs.ddev.com/en/stable/users/install/performance/#nfs
165+
# See https://docs.ddev.com/en/stable/users/install/performance/#mutagen
170166

171167
# fail_on_hook_fail: False
172168
# Decide whether 'ddev start' should be interrupted by a failing hook
@@ -215,7 +211,7 @@ disable_upload_dirs_warning: true
215211

216212
# ngrok_args: --basic-auth username:pass1234
217213
# Provide extra flags to the "ngrok http" command, see
218-
# https://ngrok.com/docs/ngrok-agent/config or run "ngrok http -h"
214+
# https://ngrok.com/docs/agent/config/v3/#agent-configuration or run "ngrok http -h"
219215

220216
# disable_settings_management: false
221217
# If true, DDEV will not create CMS-specific settings files like
@@ -293,7 +289,7 @@ disable_upload_dirs_warning: true
293289
# Many DDEV commands can be extended to run tasks before or after the
294290
# DDEV command is executed, for example "post-start", "post-import-db",
295291
# "pre-composer", "post-composer"
296-
# See https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/ for more
292+
# See https://docs.ddev.com/en/stable/users/extend/custom-commands/ for more
297293
# information on the commands that can be extended and the tasks you can define
298294
# for them. Example:
299295
#hooks:

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Kinky
22

3-
[Inky](https://get.foundation/emails/docs/inky.html) email templating language for [Kirby CMS](https://getkirby.com/).
3+
[Kirby](https://getkirby.com/) + [Inky](https://get.foundation/emails/docs/inky.html) = Kinky.
44

55
Converts simple HTML tags into the complex table required for emails. Oh là là!
66

@@ -97,7 +97,7 @@ Transformed HTML (clean example without the whole document and CSS inlining):
9797

9898
- PHP `8.2` or higher;
9999
- PHP [`dom`](http://www.php.net/manual/en/dom.installation.php) extension;
100-
- Kirby CMS `4.0` or higher.
100+
- Kirby CMS `5.0` or higher.
101101

102102
## Installation
103103

@@ -130,7 +130,7 @@ This method can be useful to help creating and previewing email templates:
130130
```php
131131
// templates/default.php
132132

133-
// template will be located at /site/templates/emails/notification.html.php
133+
// the template will be located at /site/templates/emails/notification.html.php
134134
<?= kinky()->transformTemplate('notification', [
135135
'name' => 'Kinky',
136136
'text' => 'Oh là là'
@@ -162,7 +162,7 @@ kinky()->email([
162162
]);
163163
```
164164

165-
It is basically the sames as doing the following:
165+
It is basically the same as doing the following:
166166

167167
```php
168168
kirby()->email([
@@ -185,7 +185,7 @@ kirby()->email([
185185

186186
### Custom CSS
187187

188-
To use your own custom CSS, you can just include a `<style>` element in the template and all selectors will be inlined for you.
188+
To use your own custom CSS, you can include a `<style>` element in the template and all selectors will be inlined for you.
189189

190190
Template:
191191

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Inky email templating language for Kirby CMS",
44
"type": "kirby-plugin",
55
"license": "MIT",
6-
"version": "0.1.0",
6+
"version": "0.2.0",
77
"keywords": ["kirby", "kirby-cms", "kirby-plugin", "inky", "email", "email-template"],
88
"homepage": "https://github.com/programmatordev/kinky",
99
"support": {
@@ -12,21 +12,21 @@
1212
},
1313
"authors": [
1414
{
15-
"name": "André Pimpão",
16-
"email": "a.pimpao@programmator.dev",
15+
"name": "Programmator",
16+
"email": "hotline@programmator.dev",
1717
"homepage": "https://programmator.dev"
1818
}
1919
],
2020
"require": {
2121
"php": ">=8.2.0",
2222
"getkirby/composer-installer": "^1.2",
2323
"lorenzo/pinky": "^1.1",
24-
"tijsverkoyen/css-to-inline-styles": "^2.3",
24+
"tijsverkoyen/css-to-inline-styles": "^2.4",
2525
"ext-dom": "*"
2626
},
2727
"require-dev": {
28-
"getkirby/cms": "^4.7",
29-
"symfony/var-dumper": "^7.2"
28+
"getkirby/cms": "^5.0",
29+
"symfony/var-dumper": "^7.4"
3030
},
3131
"autoload": {
3232
"psr-4": {

src/Kinky.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ private function buildEmailProps(array $props): array
5656
throw new InvalidArgumentException('The property "template" is required');
5757
}
5858

59-
// set body with transpiled template
60-
// important: do not run transformTemplate directly in props or email will be triggered twice for some reason
59+
// set the body with the transpiled template
60+
// important: do not run transformTemplate directly in props, or the email will be triggered twice for some reason
6161
$bodyHtml = $this->transformTemplate($template, $data);
6262
$props['body']['html'] = $bodyHtml;
6363

64-
// template property must be removed from props at this point
64+
// template property must be removed from props at this point,
6565
// otherwise kirby will ignore the body property
6666
unset($props['template']);
6767

@@ -87,7 +87,7 @@ private function transformHtml(string $html): string
8787
// transpile Inky template
8888
$document = Pinky\transformString($html);
8989

90-
// create Content-Type <meta> element so charset is detected correctly when inlining CSS
90+
// create a Content-Type <meta> element so charset is detected correctly when inlining CSS
9191
// https://github.com/tijsverkoyen/CssToInlineStyles?tab=readme-ov-file#known-issues
9292
$metaContentTypeElement = $document->createElement('meta');
9393
$metaContentTypeElement->setAttribute('http-equiv', 'Content-Type');
@@ -100,13 +100,13 @@ private function transformHtml(string $html): string
100100

101101
// get Inky base CSS to inject in HTML
102102
$inkyCss = F::read(__DIR__ . '/../assets/styles/foundation-emails.css');
103-
// create <style> element with Inky base CSS
103+
// create a <style> element with Inky base CSS
104104
$styleElement = $document->createElement('style', sprintf("\n%s", $inkyCss));
105105

106106
// prepend the <meta> and <style> elements to the document
107107
// this may seem a little bit weird to add <head> specific elements directly in the document,
108108
// but the transpiler and inliner will automatically wrap <meta> and <style> elements in a <head> element,
109-
// so there is no need to do it ourselves, and opens the possibility to include custom <style>s directly in the template
109+
// so there is no need to do it ourselves, and opens the possibility to include a custom <style> directly in the template
110110
$document->documentElement->prepend($metaContentTypeElement, $metaViewportElement, $styleElement);
111111

112112
// inline Inky base CSS (for best results in Gmail and Outlook)

0 commit comments

Comments
 (0)