Skip to content

Commit

Permalink
add gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbarbara committed Sep 12, 2015
1 parent 1b6a4b2 commit cb3c522
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
.publish
.tmp
bower_components
node_modules
47 changes: 46 additions & 1 deletion gulpfile.js
@@ -1,8 +1,10 @@
var gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
del = require('del'),
exec = require('child_process').exec,
merge = require('merge-stream'),
runSequence = require('run-sequence');
runSequence = require('run-sequence'),
vinylPaths = require('vinyl-paths');

// Script
gulp.task('lint', function () {
Expand Down Expand Up @@ -39,6 +41,49 @@ gulp.task('clean', function (cb) {
return del(['dist/*'], cb);
});

gulp.task('get-commit', function (cb) {
exec('git log -1 --pretty=%s && git log -1 --pretty=%b', function (err, stdout, stderr) {
var parts = stdout.replace('\n\n', '').split('\n');

commitMessage = parts[0];
if (parts[1]) {
commitMessage += ' — ' + parts[1];
}

cb(err);
});
});

gulp.task('gh-pages', function () {

var clean,
push;

clean = gulp.src('.publish/.DS_Store')
.pipe(vinylPaths(del));

push = gulp.src([
'index.html',
'dist/**/*'
], { base: './' })
.pipe($.ghPages({
branch: 'gh-pages',
message: commitMessage,
force: true,
push: false
}));

return merge(clean, push);
});

gulp.task('deploy-pages', function (cb) {
runSequence(['build', 'get-commit'], 'gh-pages', cb);
});

gulp.task('serve', function () {
gulp.watch('index.js', ['build']);
});

gulp.task('build', function (cb) {
process.env.NODE_ENV = 'production';
runSequence('clean', 'scripts', cb);
Expand Down
12 changes: 6 additions & 6 deletions example.html → index.html
Expand Up @@ -62,7 +62,8 @@
</style>
<script src="dist/disable-scroll.js"></script>
<script>
var colors = ['#5bc0eb', '#fde74c', '#9bc53d', '#e55934', '#fa7921'],

var colors = ['#5bc0eb', '#fde74c', '#9bc53d', '#e55934', '#fa7921', '#8F7892', '#f25f5c', '#ffe066', '#247ba0', '#98A584'],
controls,
steps = '',
h = 200,
Expand Down Expand Up @@ -91,8 +92,8 @@
});
}

for (i = i; i <= 4000;) {
steps += '<div style="background-color:' + colors[c % 5] + '; height: ' + h + 'px;">' + i + '</div>';
for (i = i; i <= 5000;) {
steps += '<div style="background-color:' + colors[c % 10] + '; height: ' + h + 'px;">' + i + '</div>';
i += 200;
c++;
}
Expand All @@ -107,10 +108,9 @@

<header>
<h1>disable-scroll</h1>

<div class="controls">
<a href="#" class="on" data-type="disable">turn it off</a>
<a href="#" class="off disable" data-type="enable">turn it on</a>
<a href="#" class="on" data-type="disable">turn it on</a>
<a href="#" class="off disable" data-type="enable">turn it off</a>
</div>
</header>
<div class="steps"></div>
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -19,13 +19,15 @@
"eslint": "^1.2",
"gulp": "^3.9",
"gulp-eslint": "^1.0",
"gulp-gh-pages": "^0.5.2",
"gulp-load-plugins": "^0.10",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-uglify": "^1.4.1",
"gulp-umd": "^0.2.0",
"merge-stream": "^1.0",
"run-sequence": "^1.1"
"run-sequence": "^1.1",
"vinyl-paths": "^2.0.0"
},
"scripts": {
"build": "gulp build"
Expand Down

0 comments on commit cb3c522

Please sign in to comment.