forked from elenatorro/playlingua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
136 lines (119 loc) · 4.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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* The following Gulp configuration has been created by Elena Torro */
var gulp = require("gulp");
var gutil = require("gulp-util");
var jshint = require("gulp-jshint");
var browserify = require("gulp-browserify");
var concat = require("gulp-concat");
var clean = require("gulp-clean");
var uglify = require("gulp-uglify");
var rename = require("gulp-rename");
var bowerFiles = require("main-bower-files");
var server = require("gulp-express");
var minifycss = require("gulp-minify-css");
var gulpFilter = require("gulp-filter");
var flatten = require("gulp-flatten");
var sass = require('gulp-sass');
/* bower */
gulp.task('bower-files', function() {
return gulp.src('./app/assets/bower_components/**/*')
.pipe(gulp.dest('./public/assets/bower_components/'));
});
/* javascript dependencies */
var jsDepPath = "./app/assets/dependencies/scripts/";
var jsDepDest = "./public/assets/dependencies/scripts"
var jsDependencies = [
jsDepPath + "jquery-1.11.2.min.js",
jsDepPath + "modernizr.custom.js",
jsDepPath + "bootstrap.min.js",
jsDepPath + "underscore.js"
];
gulp.task("jsDependencies", function() {
return gulp.src(jsDependencies)
.pipe(concat("dependencies.js"))
.pipe(gulp.dest(jsDepDest));
});
/* javascript angular browserify */
gulp.task("bundle", function() {
gulp.src(["app/assets/scripts/main.js", "app/assets/scripts/**/*.js"])
.pipe(concat("angular_bundle.js"))
.pipe(gulp.dest("./public/assets/scripts"));
})
/* style dependencies */
var cssDepPath = "./app/assets/dependencies/styles/";
var cssDepDest = "./public/assets/dependencies/styles/";
var cssDependencies = [
cssDepPath + "bootstrap.css",
cssDepPath + "bootswatch.css",
cssDepPath + "normalize.css",
cssDepPath + "hover-min.css"
];
gulp.task("cssDependencies", function() {
return gulp.src(cssDependencies)
.pipe(concat("dependencies.css"))
.pipe(minifycss())
.pipe(gulp.dest(cssDepDest));
});
gulp.task("style", function() {
return gulp.src("./app/assets/styles/*.css")
.pipe(concat("style.css"))
.pipe(minifycss())
.pipe(gulp.dest("./public/assets/styles"));
})
/* custom sass */
//TODO
gulp.task("customStyle", function() {
return gulp.src("./app/assets/styles/main.scss")
.pipe(sass())
.pipe(gulp.dest("./public/assets/styles"));
})
/* views */
gulp.task("views", function() {
//index
gulp.src("./app/index.html")
.pipe(gulp.dest("./public/"));
//all the views
gulp.src("./app/views/**/*")
.pipe(gulp.dest("./public/views/"));
gulp.src(["./app/assets/templates/*.html", "./app/assets/templates/**/*.html"])
.pipe(gulp.dest("./public/assets/templates"));
})
/* images */
gulp.task("images", function() {
//index
gulp.src("./app/assets/images/*")
.pipe(gulp.dest("./public/assets/images"));
})
gulp.task("fonts", function() {
//index
gulp.src("./app/assets/fonts/*")
.pipe(gulp.dest("./public/assets/fonts"));
})
/* icons */
gulp.task("icons", function() {
//index
gulp.src("./app/assets/icons/**/*.png")
.pipe(gulp.dest("./public/assets/icons"));
})
/* sounds */
gulp.task("sounds", function() {
gulp.src("./app/assets/sounds/**/*")
.pipe(gulp.dest("./public/assets/sounds/"));
})
/* watch */
gulp.task('watch', function() {
gulp.watch(jsDependencies, ["jsDependencies"]);
gulp.watch(cssDependencies, ["cssDependencies"]);
gulp.watch(["app/assets/scripts/*.js", "app/assets/scripts/**/*.js"], ["bundle"]);
gulp.watch("./app/assets/styles/*.css", ["style"]);
gulp.watch(["./app/assets/styles/*.scss", "./app/assets/styles/**/*.scss"], ["customStyle"]);
gulp.watch(["./app/views/**/*", "./app/index.html", "./app/assets/templates/*.html"], ["views"]);
gulp.watch("./app/assets/images/*", ["images"]);
gulp.watch("./app/assets/icons/*", ["icons"]);
})
/*server */
gulp.task("run", function() {
server.run(["app.js"]);
})
gulp.task("build", ["bower-files", "jsDependencies", "cssDependencies",
"style", "customStyle", "bundle", "views", "images", "icons", "fonts", "sounds"]);
gulp.task("default", ["build", "run", "watch"]);