2017 © Pedro Peláez
 

library phulp-inject

The inject addon for phulp

image

reisraff/phulp-inject

The inject addon for phulp

  • Thursday, March 15, 2018
  • by reisraff
  • Repository
  • 1 Watchers
  • 1 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

phulp-inject

The inject addon for PHULP., (*1)

It's like gulp-inject with some modifications., (*2)

Install

$ composer require reisraff/phulp-inject

Usage

The target file src/index.html:, (*3)

Each pair of comments are the injection placeholders, (*4)

<!DOCTYPE html>
<html>
<head>
  <title>App</title>
  
  
</head>
<body>

  
  
</body>
</html>

The phulpfile.php:, (*5)

<?php

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/'));
});

dist/index.html after running phulp inject:, (*6)

<!DOCTYPE html>
<html>
<head>
  <title>App</title>
  
  <link rel="stylesheet" href="css/sytle.css">
<link rel="stylesheet" href="css/style2.css">

</head>
<body>

  
  


</body>
</html>

Options

Set in the constructor., (*7)

tagname : default: inject, it is used to define a global tagname as placeholder., (*8)

starttag : default: null, it is used to replace the default starttag, (*9)

endtag : default: null, it is used to replace the default endtag, (*10)

filterFilename : default: null, it is used to replace the filename, (*11)

<?php

use Phulp\Inject\Inject;

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

The Versions

15/03 2018

dev-master

9999999-dev

The inject addon for phulp

  Sources   Download

MIT

The Requires

 

php inject phulp phulpplugin

28/10 2016

1.1.0

1.1.0.0

The inject addon for phulp

  Sources   Download

MIT

The Requires

 

php inject phulp phulpplugin

27/10 2016

1.0.0

1.0.0.0

The inject addon for phulp

  Sources   Download

MIT

The Requires

 

php inject phulp phulpplugin