1.1.2 • Published 8 years ago

gulp-waitforit v1.1.2

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
8 years ago

Build Status

alt text

Just the perfect way to use gulp with PHP.

What is it really for

  • Run gulp without opening a terminal
  • Prevent the loading of your pages when gulp is still building your assets
  • Install automatically new modules from require(...)
  • Show gulp errors on your page (yeah still no terminal)

Usage

You must use the PHP class GulpWaitforit available with composer, or just from github, it's a single file. Then use it as follow:

// We wait on gulp
// should be called before your script closes, so after rendering your view
$gulp = new GulpWaitforit();
$gulp->wait();

Now gulp need to tell us when to wait. A simple sass compiler will look like this:

// Wrap gulp with our gulp-waitforit, to catch start, stop and errors
var gulp = require('gulp-waitforit')(require('gulp')),
	sass = require('sass');

// A simple sass compilation
gulp.task('sass', function () {
	return gulp.src('**/*.scss')
		.pipe(sass())
		.pipe(gulp.dest('static/css/'));
});

// A watch for sass files
gulp.task('default', ['sass'], function () {
	gulp.watch('**/*.scss', ['sass']);
});

It's now all setup. No need for a packages.json, a default one will be installed, and npm install will be called.

Options

A few options are available in the PHP class:

$gulp = new GulpWaitforit([
	// Path to the directory of the gulpfile.js, default current directory
	'gulp_dir' => getcwd(),
	// Path to the created gulp process' output logs, default gulp_dir/gulp.log
	'log_path' => 'gulp.log',
	// Number of seconds maximum to wait for gulp to finish it's tasks, default 25 seconds
	'wait_timeout' => 25,
	// The gulp task to launch, default "default"
	'task' => 'default',
	// Stop the background process after afk_ttl after it is not used, default 10min
	'afk_ttl' => 600,
	// Locking port, default is made with the gulp_dir, returning a number between 43124 and 44320
	'port' => static::getDefaultPort()
]);

Kill me

If your want to kill the background process that PHP has started. You can open a terminal, go to the gulpfile's directory, and type gulp waitforit:kill

To suggest a feature, report a bug, or general discussion:

http://github.com/blunt1337/gulp-waitforit-php/issues/

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago