Skip to content

Commit e177a5f

Browse files
committed
v1.6.0 implemented
1 parent 08e4c17 commit e177a5f

File tree

2 files changed

+9
-153
lines changed

2 files changed

+9
-153
lines changed

README.md

Lines changed: 3 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,5 @@
1-
# Webpack-Encore plugin for Micro framework
1+
# Micro Framework
22

3-
[![Latest Version on Packagist][ico-version]][link-packagist]
4-
[![Software License][ico-license]](LICENSE.md)
5-
[![Total Downloads][ico-downloads]][link-downloads]
6-
[![Scrutinizer Code Quality][ico-scrutinizer-quality]][link-scrutinizer-quality]
7-
[![Code Coverage][ico-scrutinizer-coverage]][link-scrutinizer-coverage]
8-
[![Build Status][ico-scrutinizer-build]][link-scrutinizer-build]
3+
Documentation is available [here](https://micro-php.net/docs). If not, we will be grateful if you can become its author :)
94

10-
This plugin adds several twig functions that help to include script and style html tags to twig templates from webpack-encore entries.
11-
12-
## Get started
13-
14-
Before starting to work with the plugin, all you need is:
15-
* Project based on [Micro Framework][link-microframework];
16-
* [@symfony/webpack-encore][link-symfony-webpack-encore] installed by npm or yarn;
17-
18-
### Install
19-
20-
You can install the plugin via composer:
21-
```bash
22-
composer require oleksiibulba/webpack-encore-plugin
23-
```
24-
25-
### Usage
26-
27-
Add `OleksiiBulba\WebpackEncorePlugin\WebpackEncorePlugin` to your plugins list:
28-
```php
29-
<?php /* ./etc/plugins.php */
30-
31-
return [
32-
// List of plugins:
33-
// ...
34-
OleksiiBulba\WebpackEncorePlugin\WebpackEncorePlugin::class,
35-
// ...
36-
];
37-
```
38-
39-
To use the plugin you need to create an entrypoint in your webpack.config.js:
40-
```javascript
41-
/* ./webpack.config.js */
42-
const Encore = require('@symfony/webpack-encore');
43-
Encore
44-
/* ... */
45-
.addEntry('your_entry_name', './path/to/your_entry_file.jsx')
46-
/* ... */
47-
```
48-
49-
run build:
50-
```bash
51-
yarn dev
52-
// or
53-
npm dev
54-
```
55-
56-
and add one of the twig functions to a template:
57-
```html
58-
{# ./templates/base.html.twig #}
59-
{# ... #}
60-
<head>
61-
{{ encore_entry_script_tags('your_entry_name') }}
62-
{{ encore_entry_link_tags('your_entry_name') }}
63-
</head>
64-
{# ... #}
65-
```
66-
67-
Here is the signature of the twig functions:
68-
* encore_entry_script_tags | encore_entry_link_tags:
69-
* entryName, type: string, required;
70-
* extraAttributes, type: array, optional, default value: empty array;
71-
* getJavaScriptFiles | getCssFiles | entryExists:
72-
* entryName, type: string, required;
73-
74-
If two or more entries contain common files, then they will be printed only once;
75-
76-
#### Extra attributes
77-
To add extra attribute to the tags, you can pass them in the array as a second argument, like this:
78-
```html
79-
<head>
80-
{{ encore_entry_script_tags('your_entry_name', {'defer':true}) }}
81-
</head>
82-
```
83-
and as a result, it will print next html (assuming your entrypoint 'app' contains only one file './js/app.js'):
84-
```html
85-
<head>
86-
<script href="/js/app.js" type="application/javascript" defer></script>
87-
</head>
88-
```
89-
90-
## Change Log
91-
92-
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
93-
94-
## Testing
95-
96-
```bash
97-
composer test
98-
```
99-
100-
## Contributing
101-
102-
Please feel free to open pull request or create an issue, they are more than welcome!
103-
Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.
104-
105-
## Security
106-
107-
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
108-
109-
## Credits
110-
111-
- [Oleksii Bulba][link-author]
112-
- [Fabien Potencier][email-fabien]
113-
- [All Contributors][link-contributors]
114-
115-
The code was taken and adapted from `symfony/webpack-encore-bundle` that was created by [Symfony Community](https://symfony.com/contributors) and [Fabien Potencier](mailto:[email protected]) in particular.
116-
Adapted for Micro framework plugin by [Oleksii Bulba][link-author].
117-
118-
For the full copyright and license information, please see the [License File](LICENSE.md) that was distributed with this source code.
119-
120-
## License
121-
122-
[The MIT License (MIT)][link-license]. Please see [License File](LICENSE.md) for more information.
123-
124-
[ico-version]: https://img.shields.io/packagist/v/oleksiibulba/webpack-encore-plugin.svg?style=flat-square
125-
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
126-
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/oleksiibulba/webpack-encore-plugin.svg?style=flat-square
127-
[ico-code-quality]: https://img.shields.io/scrutinizer/g/oleksiibulba/webpack-encore-plugin.svg?style=flat-square
128-
[ico-downloads]: https://img.shields.io/packagist/dt/oleksiibulba/webpack-encore-plugin.svg?style=flat-square
129-
130-
[ico-scrutinizer-quality]: https://img.shields.io/scrutinizer/quality/g/OleksiiBulba/webpack-encore-plugin/master?style=flat-square
131-
[ico-scrutinizer-coverage]: https://img.shields.io/scrutinizer/coverage/g/OleksiiBulba/webpack-encore-plugin/master?style=flat-square
132-
[ico-scrutinizer-build]: https://img.shields.io/scrutinizer/build/g/OleksiiBulba/webpack-encore-plugin/master?style=flat-square
133-
134-
[link-scrutinizer-quality]: https://scrutinizer-ci.com/g/OleksiiBulba/webpack-encore-plugin/?branch=master
135-
[link-scrutinizer-coverage]: https://scrutinizer-ci.com/g/OleksiiBulba/webpack-encore-plugin/?branch=master
136-
[link-scrutinizer-build]: https://scrutinizer-ci.com/g/OleksiiBulba/webpack-encore-plugin/build-status/master
137-
138-
[link-microframework]: https://github.com/Micro-PHP/skeleton
139-
[link-symfony-webpack-encore]: https://www.npmjs.com/package/@symfony/webpack-encore
140-
[link-packagist]: https://packagist.org/packages/oleksiibulba/webpack-encore-plugin
141-
[link-travis]: https://travis-ci.org/oleksiibulba/webpack-encore-plugin
142-
[link-scrutinizer]: https://scrutinizer-ci.com/g/oleksiibulba/webpack-encore-plugin/code-structure
143-
[link-code-quality]: https://scrutinizer-ci.com/g/oleksiibulba/webpack-encore-plugin
144-
[link-downloads]: https://packagist.org/packages/oleksiibulba/webpack-encore-plugin
145-
[link-author]: https://github.com/OleksiiBulba
146-
[link-contributors]: ../../contributors
147-
[link-license]: https://opensource.org/licenses/MIT
148-
[email-fabien]: mailto:[email protected]
5+
Thanks to [Oleksii Bulba](https://github.com/OleksiiBulba) for implementing this plugin.

composer.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "oleksiibulba/webpack-encore-plugin",
2+
"name": "micro/plugin-twig-webpack-encore",
33
"description": "This is a Micro plugin for webpack-encore support",
44
"license": "MIT",
55
"type": "micro-plugin",
@@ -12,10 +12,9 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^8.2",
16-
"micro/kernel-boot-configuration": "^1",
17-
"micro/kernel-boot-plugin-depended": "^1",
18-
"micro/plugin-twig": "^1",
15+
"micro/kernel-boot-configuration": "^1.6",
16+
"micro/kernel-boot-plugin-depended": "^1.6",
17+
"micro/plugin-twig": "^1.6",
1918
"symfony/serializer": "^6.2"
2019
},
2120
"require-dev": {
@@ -49,8 +48,8 @@
4948
},
5049
"scripts": {
5150
"coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text",
52-
"php-cs-fix": "./vendor/bin/php-cs-fixer fix --verbose --using-cache=no",
53-
"php-cs-try": "./vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no",
51+
"php-cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --using-cache=no",
52+
"php-cs-try": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no",
5453
"phpstan": "./vendor/bin/phpstan analyze --no-progress",
5554
"phpunit": "./vendor/bin/phpunit",
5655
"psalm": "./vendor/bin/psalm --no-progress --show-info=true",

0 commit comments

Comments
 (0)