nemo64 / webpack-environment
This package is abandoned and no longer maintained.
No replacement package was suggested.
dev-master
2018-05-07 10:39 UTC
Requires
- php: 7.1.* || 7.2.*
- composer-plugin-api: ^1.1
- nemo64/environment: ^1.0
Requires (Dev)
- composer/composer: ^1.3
- mikey179/vfsstream: ^1.6
- phpunit/phpunit: ^7.0
This package is not auto-updated.
Last update: 2019-02-20 19:22:54 UTC
README
Webpack environment
This is an extension to nemo64/environment which adds a default webpack file and some configuration to the Makefile and docker configuration to easily set up a webpack in your php project.
There aren't any further local dependencies. Every node execution is run through docker.
How to install
Just run composer require --dev nemo64/webpack-environment
and the files are there.
You'll also need to implement the manifest.json
(read more) in your application.
How it works
Webpack will be executed as a docker service.
services: webpack: image: 'node:carbon' command: 'yarn run encore dev-server --host 0.0.0.0 --port 8080' ports: 8080:8080 volumes: - '.:/var/www' working_dir: /var/www
The makefile will be extended with this install job
node_modules: docker-compose.log $(wildcard package.* yarn.*) docker-compose run --rm --no-deps webpack yarn install
Example file
If you want to experiment with webpack just use this index.php
file.
<?php $manifest = json_decode(file_get_contents(__DIR__ . '/build/manifest.json'), true); ?> <!DOCTYPE html> <html> <head> <title>Example page</title> <link rel="stylesheet" href="<?php echo htmlspecialchars($manifest['build/app.css']) ?>"> </head> <body> <div class="container"> <div class="row"> <div class="col">col1</div> <div class="col">col2</div> <div class="col">col3</div> </div> </div> <script src="<?php echo htmlspecialchars($manifest['build/app.js']) ?>"></script> </body> </html>