forked from markgoodyear/headhesive.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
55 lines (48 loc) · 1.44 KB
/
gulpfile.js
File metadata and controls
55 lines (48 loc) · 1.44 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* Modules
*/
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var clean = require('gulp-rimraf');
var header = require('gulp-header');
var rename = require('gulp-rename');
var rigger = require('gulp-rigger');
var pkg = require('./package.json');
/**
* Config
*/
var config = {
name: 'Headhesive',
src: 'src/headhesive.js',
dest: 'dist/',
banner: ['/*!',
' * <%= pkg.name %> v<%= pkg.version %> - <%= pkg.description %>',
' * Url: <%= pkg.homepage %>',
' * Copyright (c) <%= pkg.author.name %> — <%= pkg.author.twitter %> — <%= pkg.author.url %>',
' * License: <%= pkg.license %>',
' */',
''].join('\n')
}
/**
* Tasks
*/
gulp.task('compile', function() {
return gulp.src(config.src)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(rigger())
.pipe(header(config.banner, { pkg: pkg }))
.pipe(uglify({preserveComments: 'some', compress: false, mangle: false, output:{ beautify: true, indent_level: 2 }}))
.pipe(gulp.dest(config.dest))
.pipe(uglify({preserveComments: 'some'}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(config.dest));
});
// Default
gulp.task('default', ['compile']);
// Watch
gulp.task('watch', function() {
gulp.watch(config.src, ['compile']);
});