c8b10f5a546cce9c993362ed2f8f1dfd37832162
MailPoet.
MailPoet done the right way.
Install.
- Install system dependencies:
php
nodejs
phantomjs
wordpress
-
Clone the repo in
wp-content/plugins
. -
Install composer.
$ curl -sS https://getcomposer.org/installer | php
$ ./composer.phar install
- Install dependencies.
$ ./do install
- Update dependencies when needed.
$ ./do update
- Copy .env.sample to .env.
$ cp .env.sample .env
Tests.
- Unit tests (using verify):
$ ./do test:unit
- Acceptance tests:
$ ./do test:acceptance
- Run all tests:
$ ./do test:all
- Debug tests:
$ ./do test:debug
CSS
assets/css/lib -> link your dependencies here
assets/css/src -> place your *.styl files here
Watch for changes and recompile
$ ./do watch
JS
Dependency example:
- add "handlebars" as a dependency in the
package.json
file
{
"dependencies": {
"handlebars": "3.0.3",
},
- Install dependencies.
$ ./do install
- Symlink the dependency:
$ ln -s node_modules/handlebars/dist/handlebars.min.js assets/js/lib/handlebars.min.js
Handlebars (views/*.hbs
)
<!-- use the `templates` block -->
<% block templates %>
<!-- include a .hbs template -->
<%= partial('my_template_1', 'form/templates/toolbar/fields.hbs') %>
<!-- include a .hbs template and register it as a partial -->
<%= partial('my_template_2', 'form/templates/blocks.hbs', '_my_partial') %>
<!-- custom partial using partial defined above -->
<script id="my_template_3" type="text/x-handlebars-template">
{{> _my_partial }}
</script>
<% endblock %>
i18n
- Use the regular WordPress functions in PHP and Twig:
__()
_n()
<p>
<%= __('Click %shere%s!') | format('<a href="#">', '</a>') | raw %>
</p>
<p>
<%= _n('deleted %d message', 'deleted %d messages', count) | format(count) %>
<!-- count === 1 -> "deleted 1 message" -->
<!-- count > 1 -> "deleted $count messages" -->
</p>
- Handlebars.
You can use Twig i18n functions in Handlebars, just load your template from a Twig view.
Description
5.12.4-pirate
Latest
Languages
PHP
73.2%
TypeScript
12.8%
JavaScript
7.7%
SCSS
2.5%
HTML
2%
Other
1.7%