-
Notifications
You must be signed in to change notification settings - Fork 21
/
gulpfile.js
81 lines (71 loc) · 2.25 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
69
70
71
72
73
74
75
76
77
78
79
80
81
var pkg = require('./package.json');
var banner = '/**\n' +
' * <%= pkg.description %>\n' +
' * @version v<%= pkg.version %>\n' +
' * @link <%= pkg.homepage %>\n' +
' * @author <%= pkg.author %>\n' +
' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
' */\n\n';
var gulp = require('gulp'),
karma = require('karma').server,
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
sass = require('gulp-sass');
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
header = require('gulp-header');
gulp.task('scripts', function() {
gulp.src([
'src/vButton/vButton.prefix',
'src/vButton/*.js',
'src/vButton/directives/*.js',
'src/vButton/services/*.js',
'src/vButton/vButton.suffix'
])
.pipe(concat('v-button.js'))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('./dist/'))
.pipe(uglify())
.pipe(rename('v-button.min.js'))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('./dist'))
});
gulp.task('styles', function() {
return gulp.src('src/vButton/styles/v-button.scss')
.pipe(sass({style: 'expanded'}))
.pipe(autoprefixer('last 2 version'))
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('dist/'))
.pipe(rename({suffix: '.min'} ))
.pipe(minifycss())
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest('dist/'))
});
gulp.task('test', function (done) {
karma.start({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done);
});
gulp.task('lint-src', function() {
return gulp.src([
'src/vButton/**/*.js',
])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('lint-tests', function() {
return gulp.src([
'test/**/*Spec.js'
])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('default', ['lint-src', 'test', 'scripts', 'styles']);
gulp.task('watch', function() {
gulp.watch('src/vButton/**/*.js', ['lint-src', 'test', 'scripts']);
gulp.watch('test/**/*.spec.js', ['lint-tests', 'test']);
gulp.watch('src/vButton/styles/**/*.scss', ['styles']);
});