forked from carrot/share-button
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (43 loc) · 1.32 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
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var accord = require('gulp-accord');
var browserify = require('gulp-browserify');
var shell = require('gulp-shell');
var del = require('del');
var autoprefixer = require('autoprefixer-stylus');
var axis = require('axis');
var poststylus = require('poststylus');
var postcssSVG = require('postcss-svg');
gulp.task('unbuild', function() {
del(['dist']);
});
gulp.task('style', function() {
var styleShareButton = gulp
.src('src/share-button.styl')
.pipe(accord('stylus', {
use: [
autoprefixer(),
axis(),
poststylus([postcssSVG({ paths: ['./src/svg' ], defaults: "[height]:100%; [width]:100%;" })])
]
}))
.pipe(gulp.dest('dist/'))
.pipe(shell(
['node_modules/.bin/minify --output dist/share-button.min.css dist/share-button.css']
))
});
gulp.task('script', function() {
var umdShareButton = gulp
.src(['src/share-button.js'], { read: false })
.pipe(browserify({
transform: ['babelify'],
standalone: 'ShareButton'
}))
.pipe(gulp.dest('dist/'))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('dist/'));
});
gulp.task('build', ['script', 'style']);
gulp.task('default', ['build']);