2017 © Pedro Peláez
 

library webpack-environment

image

nemo64/webpack-environment

  • Monday, May 7, 2018
  • by Nemo641
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Latest Stable Version Total Downloads License, (*1)

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., (*2)

There aren't any further local dependencies. Every node execution is run through docker., (*3)

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., (*4)

How it works

Webpack will be executed as a docker service., (*5)

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, (*6)

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., (*7)

<?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>

The Versions

07/05 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires