Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gulpjs/gulp
A toolkit to automate & enhance your workflow
https://github.com/gulpjs/gulp
Last synced: 7 days ago
JSON representation
A toolkit to automate & enhance your workflow
- Host: GitHub
- URL: https://github.com/gulpjs/gulp
- Owner: gulpjs
- License: mit
- Created: 2013-07-04T05:26:06.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-04-08T04:15:11.000Z (7 months ago)
- Last Synced: 2024-04-14T04:54:05.588Z (7 months ago)
- Language: JavaScript
- Homepage: https://gulpjs.com
- Size: 1.07 MB
- Stars: 32,882
- Watchers: 1,029
- Forks: 4,243
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: .github/SECURITY.md
- Support: docs/support/for-enterprise.md
Awesome Lists containing this project
- awesome - gulpjs/gulp - A toolkit to automate & enhance your workflow (JavaScript)
- awesome-frontend - gulp - The streaming build system. (Tools / Build)
- awesome-nodejs-cn - gulp - 编程式、流式快速构建系统 (包 / 构建工具)
- awesome-web - gulp
- awesome-nodejs - gulp - Streaming and fast build system that favors code over config. ![](https://img.shields.io/github/stars/gulpjs/gulp.svg?style=social&label=Star) (Repository / Build Tools)
- awesome-nodejs-cn - gulp - **star:32947** 流式和快速构建系统,更喜欢代码而不是配置 ![star > 2000][Awesome] (包 / 构建工具)
- awesome-starred-test - gulpjs/gulp - A toolkit to automate & enhance your workflow (JavaScript)
- Algorithms-Cheatsheet-Resources - Gulp.js
- awesome-gulp - Github Repository
- awesome-github-star - gulp
- awesome-frontend - gulp.js - 基于流(stream)的自动化构建工具
- awesome-nodejs - gulp - Streaming and fast build system that favors code over config. (Packages / Build tools)
- awesome-fluents - gulp
- awesome-jsgames - Gulp - A toolkit to automate & enhance your workflow. (Uncategorized / Uncategorized)
- awesome-node - gulp - Streaming and fast build system that favors code over config. (Packages / Build tools)
- awesome-gulp-cn - Github库
- awesome-nodejs-cn - gulp - 流式快速构建系统,支持代码而不是配置. (目录 / 构建工具)
- awesome-node-modules - gulp - The streaming build system. (Uncategorized / Uncategorized)
- awesome-starred - gulpjs/gulp - A toolkit to automate & enhance your workflow (others)
- jimsghstars - gulpjs/gulp - A toolkit to automate & enhance your workflow (JavaScript)
- StarryDivineSky - gulpjs/gulp - 集成内置于所有主要 IDE 中,人们正在将 gulp 与 PHP、.NET、Node.js、Java 和其他平台一起使用。强大的生态系统 - 使用 npm 模块做任何你想做的事情 + 超过 3000 个精选插件用于流式文件转换. (其他 / 网络服务_其他)
- awesome - gulpjs/gulp - A toolkit to automate & enhance your workflow (JavaScript)
- awesome - gulpjs/gulp - A toolkit to automate & enhance your workflow (JavaScript)
- awesome-nodejs - gulp - 基于流(stream)的自动化构建工具 (Uncategorized / Uncategorized)
README
The streaming build system
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
## What is gulp?
- **Automation** - gulp is a toolkit that helps you automate painful or time-consuming tasks in your development workflow.
- **Platform-agnostic** - Integrations are built into all major IDEs and people are using gulp with PHP, .NET, Node.js, Java, and other platforms.
- **Strong Ecosystem** - Use npm modules to do anything you want + over 3000 curated plugins for streaming file transformations.
- **Simple** - By providing only a minimal API surface, gulp is easy to learn and simple to use.## Installation
Follow our [Quick Start guide][quick-start].
## Roadmap
Find out about all our work-in-progress and outstanding issues at https://github.com/orgs/gulpjs/projects.
## Documentation
Check out the [Getting Started guide][getting-started-guide] and [API docs][api-docs] on our website!
__Excuse our dust! All other docs will be behind until we get everything updated. Please open an issue if something isn't working.__
## Sample `gulpfile.js`
This file will give you a taste of what gulp does.
```js
var gulp = require('gulp');
var less = require('gulp-less');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var cleanCSS = require('gulp-clean-css');
var del = require('del');var paths = {
styles: {
src: 'src/styles/**/*.less',
dest: 'assets/styles/'
},
scripts: {
src: 'src/scripts/**/*.js',
dest: 'assets/scripts/'
}
};/* Not all tasks need to use streams, a gulpfile is just another node program
* and you can use all packages available on npm, but it must return either a
* Promise, a Stream or take a callback and call it
*/
function clean() {
// You can use multiple globbing patterns as you would with `gulp.src`,
// for example if you are using del 2.0 or above, return its promise
return del([ 'assets' ]);
}/*
* Define our tasks using plain functions
*/
function styles() {
return gulp.src(paths.styles.src)
.pipe(less())
.pipe(cleanCSS())
// pass in options to the stream
.pipe(rename({
basename: 'main',
suffix: '.min'
}))
.pipe(gulp.dest(paths.styles.dest));
}function scripts() {
return gulp.src(paths.scripts.src, { sourcemaps: true })
.pipe(babel())
.pipe(uglify())
.pipe(concat('main.min.js'))
.pipe(gulp.dest(paths.scripts.dest));
}function watch() {
gulp.watch(paths.scripts.src, scripts);
gulp.watch(paths.styles.src, styles);
}/*
* Specify if tasks run in series or parallel using `gulp.series` and `gulp.parallel`
*/
var build = gulp.series(clean, gulp.parallel(styles, scripts));/*
* You can use CommonJS `exports` module notation to declare tasks
*/
exports.clean = clean;
exports.styles = styles;
exports.scripts = scripts;
exports.watch = watch;
exports.build = build;
/*
* Define default task that can be called by just running `gulp` from cli
*/
exports.default = build;
```## Use latest JavaScript version in your gulpfile
Gulp provides a wrapper that will be loaded in your ESM code, so you can name your gulpfile as `gulpfile.mjs` or with `"type": "module"` specified in your `package.json` file.
And here's the same sample from above written in **ESNext**.
```js
import { src, dest, watch } from 'gulp';
import less from 'gulp-less';
import babel from 'gulp-babel';
import concat from 'gulp-concat';
import uglify from 'gulp-uglify';
import rename from 'gulp-rename';
import cleanCSS from 'gulp-clean-css';
import del from 'del';const paths = {
styles: {
src: 'src/styles/**/*.less',
dest: 'assets/styles/'
},
scripts: {
src: 'src/scripts/**/*.js',
dest: 'assets/scripts/'
}
};/*
* For small tasks you can export arrow functions
*/
export const clean = () => del([ 'assets' ]);/*
* You can also declare named functions and export them as tasks
*/
export function styles() {
return src(paths.styles.src)
.pipe(less())
.pipe(cleanCSS())
// pass in options to the stream
.pipe(rename({
basename: 'main',
suffix: '.min'
}))
.pipe(dest(paths.styles.dest));
}export function scripts() {
return src(paths.scripts.src, { sourcemaps: true })
.pipe(babel())
.pipe(uglify())
.pipe(concat('main.min.js'))
.pipe(dest(paths.scripts.dest));
}/*
* You could even use `export as` to rename exported tasks
*/
function watchFiles() {
watch(paths.scripts.src, scripts);
watch(paths.styles.src, styles);
}
export { watchFiles as watch };const build = gulp.series(clean, gulp.parallel(styles, scripts));
/*
* Export a default task
*/
export default build;
```## Incremental Builds
You can filter out unchanged files between runs of a task using
the `gulp.src` function's `since` option and `gulp.lastRun`:
```js
const paths = {
...
images: {
src: 'src/images/**/*.{jpg,jpeg,png}',
dest: 'build/img/'
}
}function images() {
return gulp.src(paths.images.src, {since: gulp.lastRun(images)})
.pipe(imagemin())
.pipe(gulp.dest(paths.images.dest));
}function watch() {
gulp.watch(paths.images.src, images);
}
```
Task run times are saved in memory and are lost when gulp exits. It will only
save time during the `watch` task when running the `images` task
for a second time.## Want to contribute?
Anyone can help make this project better - check out our [Contributing guide](/CONTRIBUTING.md)!
[quick-start]: https://gulpjs.com/docs/en/getting-started/quick-start
[getting-started-guide]: https://gulpjs.com/docs/en/getting-started/quick-start
[api-docs]: https://gulpjs.com/docs/en/api/concepts
[esm-module]: https://github.com/standard-things/esm[downloads-image]: https://img.shields.io/npm/dm/gulp.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/gulp
[npm-image]: https://img.shields.io/npm/v/gulp.svg?style=flat-square[ci-url]: https://github.com/gulpjs/gulp/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/gulp/dev.yml?branch=master&style=flat-square[coveralls-url]: https://coveralls.io/r/gulpjs/gulp
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/gulp/master.svg?style=flat-square