forked from phonon-framework/phonon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
108 lines (100 loc) · 2.74 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var cssmin = require('gulp-cssmin');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
gulp.task('build', [
'phonon-js-core',
'phonon-js-all',
'phonon-js-components',
'phonon-css-base',
'phonon-css-all',
'phonon-css-components',
'fonts'
], function() { });
/**
* Build Phonon core
*/
gulp.task('phonon-js-core', function() {
return gulp.src([
'./src/js/core/wrap/prefix.js',
'./src/js/core/ready.js',
'./src/js/core/polyfills.js',
'./src/js/core/device.js',
'./src/js/core/browser.js',
'./src/js/core/ajax.js',
'./src/js/core/events.js',
'./src/js/core/tagmanager.js',
'./src/js/core/public.js',
'./src/js/core/wrap/suffix.js',
'./src/js/core/i18n.js',
'./src/js/core/navigator.js',
]).pipe(concat('phonon-core.js'))
.pipe(gulp.dest('./dist/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./dist/js'));
});
/**
* Build all together
*/
gulp.task('phonon-js-all', function() {
return gulp.src([
'./dist/js/phonon-core.js',
'./src/js/ui/*.js',
]).pipe(concat('phonon.js'))
.pipe(gulp.dest('./dist/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./dist/js'));
});
/**
* Build each JS component
*/
gulp.task('phonon-js-components', function () {
return gulp.src('./src/js/ui/*.js')
.pipe(gulp.dest('./dist/js/components'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./dist/js/components'));
});
/**
* Build the CSS base
*/
gulp.task('phonon-css-base', function () {
return gulp.src('./src/stylus/phonon-base.styl')
.pipe(stylus({compress: false}))
.pipe(postcss([ autoprefixer({ browsers: ['last 3 versions'] }) ]))
.pipe(gulp.dest('./dist/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cssmin())
.pipe(gulp.dest('./dist/css'));
});
/**
* Build the full CSS
*/
gulp.task('phonon-css-all', function () {
return gulp.src('./src/stylus/phonon.styl')
.pipe(stylus({compress: false}))
.pipe(postcss([ autoprefixer({ browsers: ['last 3 versions'] }) ]))
.pipe(gulp.dest('./dist/css'))
.pipe(rename({suffix: '.min'}))
.pipe(cssmin())
.pipe(gulp.dest('./dist/css'));
});
gulp.task('phonon-css-components', function () {
return gulp.src('./src/stylus/components/*.styl')
.pipe(stylus({compress: false}))
.pipe(postcss([ autoprefixer({ browsers: ['last 3 versions'] }) ]))
.pipe(gulp.dest('./dist/css/components'))
.pipe(rename({suffix: '.min'}))
.pipe(cssmin())
.pipe(gulp.dest('./dist/css/components'));
});
gulp.task('fonts', function () {
return gulp.src('./src/fonts/**/*')
.pipe(gulp.dest('./dist/fonts'));
});