-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (34 loc) · 1.06 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Generated on 2014-05-30 using generator-bookmarklet 0.2.0
'use strict';
var buffer = require('buffer');
var gulp = require('gulp');
var gulpClean = require('gulp-clean');
var gulpConcat = require('gulp-concat');
var gulpJshint = require('gulp-jshint');
var gulpUglify = require('gulp-uglify');
var jshintStylish = require('jshint-stylish');
var map = require('map-stream');
gulp.task('scripts', function () {
var header = new Buffer('// Copy this to your URL bar:\njavascript:');
gulp.src('app/{,*/}*.js')
.pipe(gulpJshint())
.pipe(gulpJshint.reporter(jshintStylish))
.pipe(gulpUglify())
.pipe(gulpConcat('bookmarklet.js'))
.pipe(map(function (file, cb) {
file.contents = buffer.Buffer.concat([header, file.contents]);
cb(null, file);
}))
.pipe(gulp.dest('dist/'));
});
gulp.task('clean', function () {
gulp.src('dist').pipe(gulpClean());
});
gulp.task('default', function () {
gulp.run('clean', 'scripts');
});
gulp.task('watch', function () {
gulp.watch('app/{,*/}*.js', function () {
gulp.run('scripts');
});
});