![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Package | gulp-util |
Description | Utility functions for gulp plugins |
Node Version | >= 0.9 |
var gutil = require('gulp-util');
gutil.log('stuff happened', 'Really it did', gutil.colors.cyan('123'));
gutil.beep();
gutil.replaceExtension('file.coffee', '.js'); // file.js
var opt = {
name: 'todd',
file: someGulpFile
};
gutil.template('test <%= name %> <%= file.path %>', opt) // test todd /js/hi.js
Logs stuff. Already prefixed with [gulp] and all that. Use the right colors for values. If you pass in multiple arguments it will join them by a space.
values (files, module names, etc.) = magenta
numbers (times, counts, etc) = cyan
This is an instance of chalk
This is an instance of node-dateformat.
Just \n
. Use this.
Replaces a file extension in a path. Returns the new path.
Returns true or false if an object is a stream.
Returns true or false if an object is a Buffer.
This is a lodash.template function wrapper. You must pass in a valid gulp file object so it is available to the user or it will error. You can not configure any of the delimiters. Look at the lodash docs for more info.
This is just vinyl
var file = new gutil.File({
base: join(__dirname, './fixtures/'),
cwd: __dirname,
path: join(__dirname, './fixtures/test.coffee')
});
Returns a stream that does nothing but pass data straight through.
gulp.task('scripts', function() {
gulp.src('src/**/*.js')
.pipe(concat('script.js'))
.pipe(gulp.env.production ? uglify() : gutil.noop())
.pipe(gulp.dest('dist/');
});
Argument may also be an array of streams. Returns a function that returns the combined stream. Useful for keeping things DRY. This is a simple wrapper around event-stream's .pipeline
var scripts = gutil.combine(
coffee({bare: true}),
uglify(),
concat('script.js'),
gulp.dest('dist/')
);
gulp.task('default', function() {
gulp.src('*.coffee').pipe(scripts());
});
This is similar to es.wait but instead of buffering text into one string it buffers anything into an array (so very useful for file objects).
Returns a stream that can be piped to.
The stream will emit one data event after the stream piped to it has ended. The data will be the same array passed to the callback.
Callback is optional and receives two arguments: error and data
gulp.src('stuff/*.js')
.pipe(gutil.buffer(function(err, files){
});
options.showStack
to true if you think the stack is important for your error.These are all acceptable forms of instantiation:
var err = new gutil.PluginError('test', {
message: 'something broke'
});
var err = new gutil.PluginError({
plugin: 'test',
message: 'something broke'
});
var err = new gutil.PluginError('test', 'something broke');
var err = new gutil.PluginError('test', 'something broke', {showStack: true});
var existingError = new Error('OMG');
var err = new gutil.PluginError('test', existingError, {showStack: true});
FAQs
Utility functions for gulp plugins
The npm package gulp-util receives a total of 456,696 weekly downloads. As such, gulp-util popularity was classified as popular.
We found that gulp-util demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.