PHP code example of reisraff / phulp-inject

1. Go to this page and download the library: Download reisraff/phulp-inject 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/ */

    

reisraff / phulp-inject example snippets




use Phulp\Inject\Inject;

$phulp->task('inject', function ($phulp) {
    $injectionFiles = $phulp->src(['src/'], '/(js|css)$/', true);

    $phulp->src(['src/'], '/html$/')
        // injecting
        ->pipe(new Inject($injectionFiles->getDistFiles()))
        // write the html file with the injected files
        ->pipe($phulp->dest('dist/'));
});



use Phulp\Inject\Inject;

$cssMinifier = new Inject(
  $distFiles,
  [
    'tagname' => 'replace-inject',
    'starttag' => '<-- replace-inject -->',
    'endtag' => '<-- endreplace-inject -->,
    'filterFilename' => function ($filename) {
      return 'path/' . $filename;
    },
  ]
);