forked from andreas83/SocialNetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
109 lines (85 loc) · 2.88 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
109
/**
* Created by j on 14.08.15.
* Modifed by nfo on 15.10.16
*
*/
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
cache = require('gulp-cache'),
babel = require("gulp-babel"),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
cssmin = require('gulp-cssmin'),
del = require('del'),
gzip = require('gulp-gzip');
gulp.task('react', function() {
return gulp.src(
[
'public/js/jsx/Author.jsx',
'public/js/jsx/Comments.jsx',
'public/js/jsx/Stream.jsx',
'public/js/jsx/Likes.jsx',
'public/js/jsx/SearchBox.jsx',
'public/js/jsx/Chat.jsx',
'public/js/jsx/ShareBox.jsx',
'public/js/jsx/Notifications.jsx',
'public/js/jsx/InitStream.jsx'
]
)
.pipe(babel({"presets": ["react"]}))
.pipe(concat('react.js'))
.pipe(gulp.dest('public/js/'))
});
gulp.task('compress-js', function(){
return gulp.src(
[
"bower_components/highlightjs/highlight.pack.min.js",
"bower_components/jquery/dist/jquery.min.js",
"bower_components/jquery-textcomplete/dist/jquery.textcomplete.min.js",
"bower_components/bootstrap-css/js/bootstrap.min.js",
"bower_components/react/react.min.js",
"bower_components/react/react-dom.min.js",
"public/js/main.js",
"public/js/react.js"
]
)
.pipe(uglify())
.pipe(concat('app.js'))
.pipe(gzip())
.pipe(gulp.dest('public/js/'))
});
gulp.task('sass', function () {
return gulp.src('public/css/scss/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('public/css'));
});
gulp.task('compress-css', function(){
return gulp.src(['bower_components/fontawesome/css/font-awesome.min.css',
'bower_components/bootstrap-css/css/bootstrap.min.css',
'bower_components/highlightjs/styles/railscasts.css',
'public/css/dmdn.css'])
.pipe(concat('style.min.css'))
.pipe(cssmin())
.pipe(gulp.dest('public/css'));
});
gulp.task('icons', function() {
return gulp.src(['bower_components/fontawesome/fonts/**.*', 'bower_components/bootstrap-css/fonts/*.*'])
.pipe(gulp.dest('public/fonts'));
});
gulp.task('default', function() {
gulp.start('react', 'sass', 'compress-css', 'compress-js', 'icons');
});
gulp.task('watch', function() {
// Watch .scss files
gulp.watch('public/css/scss/*.scss', ['sass']);
// Watch .jsx files
gulp.watch('public/jsx/*.jsx', ['react']);
});
gulp.task('watch', function() {
// Create LiveReload server
livereload.listen();
// Watch any files in dist/, reload on change
gulp.watch(['dist/**']).on('change', livereload.changed);
});