Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ethercreative/craft-b
Shared module for traditional Craft/Twig sites
https://github.com/ethercreative/craft-b
Last synced: about 2 months ago
JSON representation
Shared module for traditional Craft/Twig sites
- Host: GitHub
- URL: https://github.com/ethercreative/craft-b
- Owner: ethercreative
- Created: 2021-02-11T09:04:30.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-11T13:15:39.000Z (almost 4 years ago)
- Last Synced: 2024-04-25T15:42:51.356Z (8 months ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# craft-b
Shared module for traditional Craft/Twig sites## Installation
```shell
$ composer require ether/craftb
```In `config/app.php`:
```php
[
'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](#config).```twig
{% atom 'hero' {} %}
```Also supports `children` (will inject a variable called `children`):
```twig
{% atom 'hero' {} %}
Hello world!
{% endatom %}
```### Critical
For use with [Build](https://github.com/tam/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](#config).```twig
{% critical 'about' %}
```## Config
You can override the config by creating a `B.php` file in the `config` directory.
See [config.php](src/config.php) for the available settings.## Development
With Docker installed run:
```shell
$ docker-compose run php composer install
```