This repository has been archived by the owner on May 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGulpfile.js
75 lines (68 loc) · 2.02 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
// Call Plugins
var env = require('minimist')(process.argv.slice(2)),
gulp = require('gulp'),
gutil = require('gulp-util'),
plumber = require('gulp-plumber'),
minifyHtml = require('gulp-minify-html'),
uglify = require('gulp-uglify'),
cleancss = require('gulp-clean-css'),
concat = require('gulp-concat'),
concatcss = require('gulp-concat-css'),
gulpif = require('gulp-if'),
cache = require('gulp-cache'),
rename = require('gulp-rename'),
rsync = require('gulp-rsync'),
order = require("gulp-order"),
fs = require("fs"),
os = require("os"),
homeDir = os.homedir();
// Call Uglify and Concat JS
gulp.task('js', function(){
return gulp.src([
'src/js/editor.js'
])
.pipe(concat('liveeditor.js'))
.pipe(uglify())
.pipe(gulp.dest('build/js'));
});
gulp.task('css', function() {
return gulp.src(["src/css/editor.css"], {restore: true})
.pipe(concatcss('liveeditor.css'))
.pipe(cleancss())
.pipe(gulp.dest('build/css'));
});
gulp.task('twig', function() {
return gulp.src('src/*.twig')
.pipe(minifyHtml())
.pipe(gulp.dest('build'));
});
gulp.task('php', function() {
return gulp.src('src/*.php')
.pipe(gulp.dest('build'));
});
gulp.task('publish', function() {
return gulp.src('build/**/*')
.pipe(plumber())
.pipe(rsync({
root: 'build/',
hostname: 'evcircuits.com',
username: 'guruevi',
privateKey: fs.readFileSync('/home/username/.ssh/id_rsa'),
destination: '/var/www/html/web/modules/liveeditor',
archive: true,
silent: false,
compress: true
}))
.on('error', function(err) {
console.log(err);
});
});
// Call Watch
gulp.task('watch', function(){
gulp.watch('src/js/**/*.js', ['js']);
gulp.watch('src/css/**/*.css', ['css']);
gulp.watch('src/*.php', ['php']);
gulp.watch('src/*.twig', ['twig']);
});
// Default task
gulp.task('default', ['js', 'css', 'php', 'twig', 'watch']);