https://github.com/nativecode-dev/build-config-gulp
https://github.com/nativecode-dev/build-config-gulp
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nativecode-dev/build-config-gulp
- Owner: nativecode-dev
- License: mit
- Created: 2016-05-31T19:31:58.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-16T06:12:29.000Z (almost 10 years ago)
- Last Synced: 2025-03-28T11:17:04.706Z (about 1 year ago)
- Language: JavaScript
- Size: 130 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-build-tasks
Simple set of build tasks for quickly getting a project up and running with Gulp.
Provides a simple workflow for building, packaging, and publishing your project.
## Getting Started
Here is a simple example of just doing some JS processing.
```
'use strict'
var gulp = (require('./src/index.js')(require('gulp')))
gulp.build({
'src/**/*.js': src => src
.pipe(gulp.use.cached('js'))
.pipe(gulp.use.jslint())
.pipe(gulp.use.babel({ presets: ['es2015'] }))
.pipe(gulp.use.uglify())
.pipe(gulp.dest('dist'))
})
gulp.publish({ tasks: ['build'] }).npm()
gulp.reload({
'package.json': ['build'],
'src/**/*.js': ['build:src/**/*.js']
}, ['build'])
gulp.task('default', ['build'])
gulp.task('watch', ['build', 'watch:reload'])
```
This is the `gulpfile.js` for the project itself. One of the goals is to provide a concise
syntax to describe build actions. The `build` method accepts two forms for defining your
pipeline.
The first form is a complete object instance. You would only want this if you want to have
clean names.
```
name: {
build: function(gulp),
src: array | glob
}
```
The second form is more concise, but creates mangled build names. You can see this version
used to process the JS files in the example above.
```
glob: function(gulp)
```
`build` will emit a task named 'build' as well as one for each name/glob specified in the
parameter options.
```
gulp.build({
'src/**/*.js': src => src
.pipe(gulp.use.cached())
.pipe(gulp.use.debug({ title: 'js:' }))
.pipe(gulp.use.jslint())
.pipe(gulp.use.babel({ presets: ['es2015'] }))
.pipe(gulp.use.uglify())
.pipe(gulp.dest('dist'))
})
```
Produces:
- "build"
- "build:src/\*\*/\*.js"
```
gulp.build({
js: {
build: src => src
.pipe(gulp.use.cached())
.pipe(gulp.use.debug({ title: 'js:' }))
.pipe(gulp.use.jslint())
.pipe(gulp.use.babel({ presets: ['es2015'] }))
.pipe(gulp.use.uglify())
.pipe(gulp.dest('dist')),
src: ['src/**/*.js']
}
})
```
Produces:
- "build"
- "build:js"