This repository has been archived by the owner on Jan 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
102 lines (93 loc) · 3.2 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
var gulp = require('gulp');
var gp_babel = require('gulp-babel');
var clean = require('gulp-clean');
var sass = require('gulp-sass');
var gp_concat = require('gulp-concat');
var gp_rename = require('gulp-rename');
let gp_uglify = require('gulp-uglify-es').default;
var gp_sourcemaps = require('gulp-sourcemaps');
var gp_minifyjs = require('gulp-js-minify');
let gp_cleanCSS = require('gulp-clean-css');
// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
return gulp.src(
[
'node_modules/bootstrap/dist/css/bootstrap.css',
'node_modules/font-awesome/scss/*.scss',
'app/assets/scss/*.scss'
])
.pipe(gp_sourcemaps.init())
.pipe(sass())
.pipe(gp_cleanCSS({compatibility: 'ie8'}))
.pipe(gp_rename({ suffix: '.min' }))
.pipe(gp_sourcemaps.write("./"))
.pipe(gulp.dest("public/css"));
});
// Move the javascript files into our /src/js folder
gulp.task('js', function() {
return gulp.src(
[
'node_modules/jquery/dist/jquery.js',
'node_modules/bootstrap/dist/js/bootstrap.js',
'app/assets/js/main-page-comparison-transpiled.js',
'app/assets/js/exchange/header-values.js'
]
) // .pipe(gp_sourcemaps.init()) // uncomment this for sourcemap
.pipe(gp_concat('concat.js'))
.pipe(gp_babel({
presets: ['es2015']
}))
.pipe(gp_minifyjs())
.pipe(gp_rename('bundle.min.js'))
.pipe(gp_uglify())
// .pipe(gp_sourcemaps.write('./')) // uncomment this for sourcemap
.pipe(gulp.dest("public/js"));
});
/*
// Move the javascript files into our /src/js folder
gulp.task('js-main', function() {
return gulp.src(
[
'app/assets/js/main-page-comparison-transpiled.js',
'app/assets/js/exchange/header-values.js'
]
) // .pipe(gp_sourcemaps.init()) // uncomment this for sourcemap
.pipe(gp_concat('concat.js'))
.pipe(gp_babel({
presets: ['es2015']
}))
.pipe(gp_minifyjs())
.pipe(gp_rename('main.min.js'))
.pipe(gp_uglify())
// .pipe(gp_sourcemaps.write('./')) // uncomment this for sourcemap
.pipe(gulp.dest("public/js"));
});
*/
// Settings - Exchange
/*
gulp.task('js-settings', function() {
return gulp.src(
[
'app/assets/js/exchange/header-values.js'
]
) // .pipe(gp_sourcemaps.init()) // uncomment this for sourcemap
.pipe(gp_concat('concat.js'))
.pipe(gp_babel({
presets: ['es2015']
}))
//.pipe(gp_minifyjs())
.pipe(gp_rename('settings.min.js'))
//.pipe(gp_uglify())
// .pipe(gp_sourcemaps.write('./')) // uncomment this for sourcemap
.pipe(gulp.dest("public/js"));
});
*/
// watching scss/html files
gulp.task('watch', ['sass'], function() {
gulp.watch(['node_modules/bootstrap/dist/css/bootstrap.css', 'app/assets/scss/*.scss'], ['sass']);
});
gulp.task('clean', function () {
return gulp.src('public/js/concat.js', {read: false})
.pipe(clean());
});
gulp.task('default', ['js','watch']);