Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deprecated-packages/barista
The Barista explores every Latte (file) for strict quality, helps with Latte 2 to 3 upgrade
https://github.com/deprecated-packages/barista
ast latte nette php
Last synced: about 1 month ago
JSON representation
The Barista explores every Latte (file) for strict quality, helps with Latte 2 to 3 upgrade
- Host: GitHub
- URL: https://github.com/deprecated-packages/barista
- Owner: deprecated-packages
- Archived: true
- Created: 2022-05-14T21:29:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-31T19:25:48.000Z (over 2 years ago)
- Last Synced: 2024-09-23T20:02:17.731Z (about 1 month ago)
- Topics: ast, latte, nette, php
- Language: PHP
- Homepage:
- Size: 78.1 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# The Barista makes Your Perfectly Tasty Latte
Do you drink [Latte](https://latte.nette.org/en/) with your templates?
Get it from Barista that knows his job:
* explore Latte via node visitors
* upgrade Latte 2 to 3
* lint your Latte files with context of your project## Lint Your Files with Custom Macros and Filters
Native latte linter does not understand the context of your project. If you use custom macros or filters, it will be falsely reported as missing. The Barista Linter fixes this.
To get context aware Latte, we have to provide it via custom PHP file. This file must return the `Latte\Engine` from your project. Create e.g. `tests/latte-provider.php` with following content:
```php
use App\DI\ContainerFactory;
use Nette\Bridges\ApplicationLatte\LatteFactory$containerFactory = new ContainerFactory();
$container = $containerFactory->create();/** @var LatteFactory $latteFactory */
$latteFactory = $container->getByType(LatteFactory::class);
return $latteFactory->create();
```Create `barista.neon` in your root and configure parameter:
```yaml
parameters:
latteProviderFile: "tests/latte-provider.php"
```Then run linting command on your paths:
```bash
vendor/bin/barista lint templates/some-file.latte
```Then linter knows about all your macros and functions and reports only real bugs!