Skip to content

Commit 837a549

Browse files
committed
Add gulp netlify task
1 parent 9d5aaf9 commit 837a549

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The following commands will then be available from the repository root:
4646
> gulp docs // generate GitBook documentation (`dist/docs`)
4747
> gulp samples // prepare samples for release (`dist/samples`)
4848
> gulp package // create an archive with dist files and samples
49+
> gulp netlify // prepare Netlify artifacts (`dist/www`)
4950

5051
## License
5152

gulpfile.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var argv = require('yargs')
2020
.option('output', {alias: 'o', default: 'dist'})
2121
.option('samples-dir', {default: 'samples'})
2222
.option('docs-dir', {default: 'docs'})
23+
.option('www-dir', {default: 'www'})
2324
.argv;
2425

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

105+
gulp.task('netlify', ['build', 'docs', 'samples'], function() {
106+
var root = argv.output;
107+
var out = path.join(root, argv.wwwDir);
108+
var streams = merge(
109+
gulp.src(path.join(root, argv.docsDir, '**/*'), {base: path.join(root, argv.docsDir)}),
110+
gulp.src(path.join(root, argv.samplesDir, '**/*'), {base: root}),
111+
gulp.src(path.join(root, '*.js'))
112+
);
113+
114+
return streams
115+
.pipe(streamify(replace(/https?:\/\/chartjs-plugin-deferred\.netlify\.com\/?/g, '/', {skipBinary: true})))
116+
.pipe(gulp.dest(out));
117+
});
118+
104119
gulp.task('bower', function() {
105120
var json = JSON.stringify({
106121
name: pkg.name,

0 commit comments

Comments
 (0)