PHP code example of nsrosenqvist / phulp-webpack

1. Go to this page and download the library: Download nsrosenqvist/phulp-webpack library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nsrosenqvist / phulp-webpack example snippets




use NSRosenqvist\Phulp\Webpack\Webpack;
use NSRosenqvist\Phulp\Webpack\Raw;

$phulp->task('scripts', function ($phulp) {
    $phulp->src(['assets/scripts/'], 'main.js')
        ->pipe(new Webpack([
            'module' => [
                'rules' => [
                    [
                        'test' => new Raw('/\.js$/'),
                        'exclude' => new Raw('/(node_modules|bower_components)/'),
                        'use' => [
                            'loader' => 'babel-loader',
                            'options' => [
                                'presets' => ['@babel/preset-env'],
                            ],
                        ],
                    ],
                ],
            ],
        ]))
        ->pipe($phulp->dest('dist/scripts/'));
});