This package is abandoned and no longer maintained. No replacement package was suggested.

dev-master 2018-05-07 10:39 UTC

This package is not auto-updated.

Last update: 2019-02-20 19:22:54 UTC


Latest Stable Version Total Downloads License

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.

    image: 'node:carbon'
    command: 'yarn run encore dev-server --host --port 8080'
      - '.:/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>
        <title>Example page</title>
        <link rel="stylesheet" href="<?php echo htmlspecialchars($manifest['build/app.css']) ?>">
        <div class="container">
            <div class="row">
                <div class="col">col1</div>
                <div class="col">col2</div>
                <div class="col">col3</div>
        <script src="<?php echo htmlspecialchars($manifest['build/app.js']) ?>"></script>