-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
68 lines (62 loc) · 1.85 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var gulp = require('gulp');
var sass = require('gulp-sass');
var jshint = require('gulp-jshint');
var umd = require('gulp-umd');
var patterns = require('umd-templates');
var uglify = require('gulp-uglify');
var header = require('gulp-header');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var pkg = require('./package.json');
var banner = ['/*!',
' * <%= fileName %> v<%= pkg.version %>',
' * <%= pkg.homepage %>',
' * Licensed under <%= pkg.license %>',
' */',
''].join('\n');
gulp.task('js', function() {
return gulp.src('./src/social-sharer.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
.pipe(umd({
exports: function() {
return 'SocialSharer';
},
namespace: function() {
return 'SocialSharer';
}
}))
.pipe(uglify())
.pipe(header(banner, { pkg: pkg, fileName: 'social-sharer.js' }))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist'));
});
gulp.task('jquery', function() {
return gulp.src('./src/*.js')
.pipe(concat('jquery.social-sharer.js'))
.pipe(umd({
exports: function() {
return 'plugin';
},
namespace: function() {
return 'socialSharer';
},
template: patterns.jqueryPluginCommonjs.path
}))
.pipe(uglify())
.pipe(header(banner, { pkg: pkg, fileName: 'jquery.social-sharer.js' }))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist'));
});
gulp.task('sass', function () {
return gulp.src('./src/*.scss')
.pipe(sass({ outputStyle: 'compressed' }).on('error', sass.logError))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist'));
});
gulp.task('dev', function () {
gulp.watch('./src/*.scss', ['sass']);
gulp.watch('./src/*.js', ['js', 'jquery']);
});
gulp.task('build', ['sass', 'js', 'jquery']);