Skip to content

Commit

Permalink
Add gulp netlify task
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbrunel committed Jan 11, 2018
1 parent 9d5aaf9 commit 837a549
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ The following commands will then be available from the repository root:
> gulp docs // generate GitBook documentation (`dist/docs`)
> gulp samples // prepare samples for release (`dist/samples`)
> gulp package // create an archive with dist files and samples
> gulp netlify // prepare Netlify artifacts (`dist/www`)

## License

Expand Down
15 changes: 15 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var argv = require('yargs')
.option('output', {alias: 'o', default: 'dist'})
.option('samples-dir', {default: 'samples'})
.option('docs-dir', {default: 'docs'})
.option('www-dir', {default: 'www'})
.argv;

function watch(glob, task) {
Expand Down Expand Up @@ -101,6 +102,20 @@ gulp.task('package', ['build', 'samples'], function() {
.pipe(gulp.dest(out));
});

gulp.task('netlify', ['build', 'docs', 'samples'], function() {
var root = argv.output;
var out = path.join(root, argv.wwwDir);
var streams = merge(
gulp.src(path.join(root, argv.docsDir, '**/*'), {base: path.join(root, argv.docsDir)}),
gulp.src(path.join(root, argv.samplesDir, '**/*'), {base: root}),
gulp.src(path.join(root, '*.js'))
);

return streams
.pipe(streamify(replace(/https?:\/\/chartjs-plugin-deferred\.netlify\.com\/?/g, '/', {skipBinary: true})))
.pipe(gulp.dest(out));
});

gulp.task('bower', function() {
var json = JSON.stringify({
name: pkg.name,
Expand Down

0 comments on commit 837a549

Please sign in to comment.