Skip to content

Commit 29ccc37

Browse files
committed
Chore: package improvements
- Renamed LICENSE file to LICENSE.md; - Added scripts to composer.json; - Improved README.md; Signed-off-by: Oleksii Bulba <[email protected]>
1 parent 35da616 commit 29ccc37

File tree

3 files changed

+97
-12
lines changed

3 files changed

+97
-12
lines changed

LICENSE renamed to LICENSE.md

File renamed without changes.

README.md

Lines changed: 88 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,64 @@
11
# Webpack-Encore plugin for 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+
37
This plugin adds several twig functions that help to include script and style html tags to twig templates from webpack-encore entries.
48

59
## Get started
610

711
Before starting to work with the plugin, all you need is:
8-
* Project based on [Micro Framework](https://github.com/Micro-PHP/skeleton);
9-
* [@symfony/webpack-encore](https://www.npmjs.com/package/@symfony/webpack-encore) installed by npm or yarn;
10-
* Run composer command `composer require oleksiibulba/webpack-encore-plugin`;
11-
* Add `\Boo\WebpackEncorePlugin\WebpackEncorePlugin` to your plugins list;
12+
* Project based on [Micro Framework][link-microframework];
13+
* [@symfony/webpack-encore][link-symfony-webpack-encore] installed by npm or yarn;
14+
15+
### Install
16+
17+
You can install the plugin via composer:
18+
```bash
19+
composer require oleksiibulba/webpack-encore-plugin
20+
```
21+
22+
### Usage
23+
24+
Add `OleksiiBulba\WebpackEncorePlugin\WebpackEncorePlugin` to your plugins list:
25+
```php
26+
<?php /* ./etc/plugins.php */
1227

13-
## Usage
28+
return [
29+
// List of plugins:
30+
// ...
31+
OleksiiBulba\WebpackEncorePlugin\WebpackEncorePlugin::class,
32+
// ...
33+
];
34+
```
35+
36+
To use the plugin you need to create an entrypoint in your webpack.config.js:
37+
```javascript
38+
/* ./webpack.config.js */
39+
const Encore = require('@symfony/webpack-encore');
40+
Encore
41+
/* ... */
42+
.addEntry('your_entry_name', './path/to/your_entry_file.jsx')
43+
/* ... */
44+
```
45+
46+
run build:
47+
```bash
48+
yarn dev
49+
// or
50+
npm dev
51+
```
1452

15-
To use the plugin you need to create an entrypoint in your webpack.config.js, run build, and add one of the twig functions to a template:
53+
and add one of the twig functions to a template:
1654
```html
55+
{# ./templates/base.html.twig #}
56+
{# ... #}
1757
<head>
1858
{{ encore_entry_script_tags('your_entry_name') }}
1959
{{ encore_entry_link_tags('your_entry_name') }}
2060
</head>
61+
{# ... #}
2162
```
2263

2364
Here is the signature of the twig functions:
@@ -29,7 +70,7 @@ Here is the signature of the twig functions:
2970

3071
If two or more entries contain common files, then they will be printed only once;
3172

32-
### Extra attributes
73+
#### Extra attributes
3374
To add extra attribute to the tags, you can pass them in the array as a second argument, like this:
3475
```html
3576
<head>
@@ -43,17 +84,53 @@ and as a result, it will print next html (assuming your entrypoint 'app' contain
4384
</head>
4485
```
4586

87+
## Change Log
88+
89+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
90+
91+
## Testing
92+
93+
```bash
94+
composer test
95+
```
96+
4697
## Contributing
4798

4899
Please feel free to open pull request or create an issue, they are more than welcome!
49100

50-
## Authors
101+
## Security
102+
103+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
104+
105+
## Credits
106+
107+
- [Oleksii Bulba][link-author]
108+
- [Fabien Potencier][email-fabien]
109+
- [All Contributors][link-contributors]
51110

52111
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.
53-
Adapted for Micro framework plugin by Oleksii Bulba.
112+
Adapted for Micro framework plugin by [Oleksii Bulba][link-author].
54113

55-
For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
114+
For the full copyright and license information, please see the [License File](LICENSE.md) that was distributed with this source code.
56115

57116
## License
58117

59-
[MIT](https://opensource.org/licenses/MIT)
118+
[The MIT License (MIT)][link-license]. Please see [License File](LICENSE.md) for more information.
119+
120+
[ico-version]: https://img.shields.io/packagist/v/oleksiibulba/webpack-encore-plugin.svg?style=flat-square
121+
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
122+
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/oleksiibulba/webpack-encore-plugin.svg?style=flat-square
123+
[ico-code-quality]: https://img.shields.io/scrutinizer/g/oleksiibulba/webpack-encore-plugin.svg?style=flat-square
124+
[ico-downloads]: https://img.shields.io/packagist/dt/oleksiibulba/webpack-encore-plugin.svg?style=flat-square
125+
126+
[link-microframework]: https://github.com/Micro-PHP/skeleton
127+
[link-symfony-webpack-encore]: https://www.npmjs.com/package/@symfony/webpack-encore
128+
[link-packagist]: https://packagist.org/packages/oleksiibulba/webpack-encore-plugin
129+
[link-travis]: https://travis-ci.org/oleksiibulba/webpack-encore-plugin
130+
[link-scrutinizer]: https://scrutinizer-ci.com/g/oleksiibulba/webpack-encore-plugin/code-structure
131+
[link-code-quality]: https://scrutinizer-ci.com/g/oleksiibulba/webpack-encore-plugin
132+
[link-downloads]: https://packagist.org/packages/oleksiibulba/webpack-encore-plugin
133+
[link-author]: https://github.com/OleksiiBulba
134+
[link-contributors]: ../../contributors
135+
[link-license]: https://opensource.org/licenses/MIT
136+
[email-fabien]: mailto:[email protected]

composer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"authors": [
88
{
99
"name": "Oleksii Bulba",
10-
"email": "[email protected]"
10+
"email": "[email protected]",
11+
"homepage": "https://github.com/OleksiiBulba",
12+
"role": "Developer"
1113
}
1214
],
1315
"require": {
@@ -43,5 +45,11 @@
4345
"name": "symfony/webpack-encore-bundle",
4446
"url": "https://github.com/symfony/webpack-encore-bundle"
4547
}
48+
},
49+
"scripts": {
50+
"php-cs-fix": "./vendor/bin/php-cs-fixer fix --verbose --using-cache=no",
51+
"php-cs-try": "./vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no",
52+
"phpstan": "./vendor/bin/phpstan analyze --no-progress",
53+
"phpunit": "./vendor/bin/phpunit"
4654
}
4755
}

0 commit comments

Comments
 (0)