This package has been deprecated

Author message:

WARNING: This package is abandoned and no longer maintained. Please use '@cedx/gulp-php-minify' instead. See 'https://github.com/cedx/gulp-php-minify' for more information.

@aquafadas/gulp-php-minify

0.3.1 • Public • Published

Gulp-PHP-Minify

Release License Downloads Dependencies Code quality

Gulp.js plugin minifying PHP source code by removing comments and whitespace.

Getting Started

If you haven't used Gulp.js before, be sure to check out the related documentation, as it explains how to create a gulpfile.js as well as install and use plugins. Once you're familiar with that process, you may install this plugin with this command:

$ npm install --save-dev @aquafadas/gulp-php-minify

Once the plugin has been installed, it may be enabled inside your gulpfile.js.

Usage

The plugin takes a list of PHP scripts as input, and removes the comments and whitespace in these files by applying the php_strip_whitespace() function on their contents:

const gulp = require('gulp');
const phpMinify = require('@aquafadas/gulp-php-minify');

gulp.task('minify:php', () => gulp.src('path/to/lib/**/*.php', {read: false})
  .pipe(phpMinify())
  .pipe(gulp.dest('path/to/out'))
);

The plugin only needs the file paths, so you should specify the read option to false when providing the file list, and you should not have any other plugin before it.

Options

binary

The plugin relies on the availability of the PHP executable on the target system: it requires a version 5.5 or later. By default, the plugin will use the php binary found on the system path.

If the plugin cannot find the default php binary, or if you want to use a different one, you can provide the path to the php executable by using the binary option:

return gulp.src('path/to/lib/**/*.php', {read: false})
  .pipe(phpMinify({binary: 'C:\\Program Files\\PHP\\php.exe'}))
  .pipe(gulp.dest('path/to/out'));

silent

By default, the plugin prints to the standard output the paths of the minified scripts. You can disable this output by setting the silent option to true.

return gulp.src('path/to/lib/**/*.php', {read: false})
  .pipe(phpMinify({silent: true}))
  .pipe(gulp.dest('path/to/out'));

See Also

License

Gulp-PHP-Minify is distributed under the Apache License, version 2.0.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published

Package Sidebar

Install

npm i @aquafadas/gulp-php-minify

Weekly Downloads

2

Version

0.3.1

License

Apache-2.0

Last publish

Collaborators

  • aquafadas