-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
57 lines (51 loc) · 1.45 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
// npm i --save gulp gulp-concat gulp-rename gulp-uglify gulp-clean-css del
var gulp = require('gulp');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var cleanCSS = require('gulp-clean-css');
var del = require('del');
var jsFiles = [
'vendor/javascripts/material.min.js',
'vendor/javascripts/jquery-3.1.1.min.js',
'vendor/javascripts/jquery.fitvids.js',
'vendor/javascripts/app.js'
],
jsDest = 'app/assets/javascripts';
var cssFiles = [
'vendor/stylesheets/material.min.css',
'vendor/stylesheets/animate.css',
'vendor/stylesheets/styles.css',
'vendor/stylesheets/custom.css'
];
cssDest = 'app/assets/stylesheets';
// javascripts
gulp.task('build:javascripts', function () {
return gulp.src(jsFiles)
.pipe(concat('application.js'))
.pipe(gulp.dest(jsDest))
.pipe(rename('application.min.js'))
.pipe(uglify())
.pipe(gulp.dest(jsDest));
});
// stylesheets
gulp.task('build:stylesheets', function () {
return gulp.src(cssFiles)
.pipe(concat('application.css'))
.pipe(gulp.dest(cssDest))
.pipe(rename('application.min.css'))
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest(cssDest));
});
// clean
gulp.task('build:clean', function () {
return del([
'app/assets/stylesheets/application.css',
'app/assets/javascripts/application.js'
]);
});
gulp.task('default', [
'build:javascripts',
'build:stylesheets',
'build:clean'
]);