ether / craftb
Ether's base module for traditional Craft / Twig sites
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 1
Open Issues: 0
Type:yii2-module
Requires
- craftcms/cms: ^3.5.0
This package is auto-updated.
Last update: 2024-12-11 21:49:40 UTC
README
Shared module for traditional Craft/Twig sites
Installation
$ composer require ether/craftb
In config/app.php
:
<?php return [ 'modules' => [ 'craft-b' => [ 'class' => '\ether\craftb\CraftB', ], ], 'bootstrap' => ['craft-b'], ];
Twig
Atom
Renders an atom (basically a module or component but with a shorter name).
Optionally you can pass some variables. The context is never passed to the atom,
and it will fail silently if it doesn't exist.
By default, it will load templates from the _atoms
directory in your
templates
folder. You can change this by adding a config file.
{% atom 'hero' {} %}
Also supports children
(will inject a variable called children
):
{% atom 'hero' {} %} <h1>Hello world!</h1> {% endatom %}
Critical
For use with Build.
Outputs critical css into the head of the rendered template.
Will look for css files in the _critical
directory in templates
. You can
change this in the config file.
{% critical 'about' %}
Config
You can override the config by creating a B.php
file in the config
directory.
See config.php for the available settings.
Development
With Docker installed run:
$ docker-compose run php composer install