forked from coderdojo-linz/coderdojo-linz.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
94 lines (81 loc) · 3.33 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
/// <binding BeforeBuild='default' ProjectOpened='sass:watch' />
/*
This file in the main entry point for defining Gulp tasks and using Gulp plugins.
Click here to learn more. http://go.microsoft.com/fwlink/?LinkId=518007
*/
// include plug-ins
var gulp = require("gulp");
var concat = require("gulp-concat");
var uglify = require("gulp-uglify");
var del = require("del");
var sass = require("gulp-sass");
var ts = require("gulp-typescript");
var sourcemaps = require("gulp-sourcemaps");
var changed = require("gulp-changed");
var newer = require('gulp-newer');
var minifycss = require("gulp-minify-css");
var dependencyScripts = ["bower_components/bootstrap/dist/js/bootstrap.js", "bower_components/bootstrap-material-design/dist/js/material.js", "bower_components/bootstrap-material-design/dist/js/ripples.js"];
var dependencyStylesheets = ["bower_components/bootstrap/dist/css/bootstrap.css", "bower_components/bootstrap-material-design/dist/css/material-fullpalette.css", "bower_components/bootstrap-material-design/dist/css/ripples.css", "bower_components/bootstrap-material-design/dist/css/roboto.css"];
var bootstrapFonts = ["bower_components/bootstrap/dist/fonts/*.*", "bower_components/bootstrap-material-design/dist/fonts/*.*"];
//var uiGridResources = ["bower_components/angular-ui-grid/ui-grid.eot", "bower_components/angular-ui-grid/ui-grid.svg", "bower_components/angular-ui-grid/ui-grid.ttf", "bower_components/angular-ui-grid/ui-grid.woff"];
var customStylesheets = ["styles/sass/styles.scss", "styles/sass/sushi.scss"];
var typescriptFiles = ["app.ts"];
// Delete scripts for dependencies
gulp.task("clean", function () {
del.sync(["scripts/*.*"]);
del.sync(["styles/*.*"]);
del.sync(["fonts/*.*"]);
});
// Combine and minify all scripts from the bower_components folder
gulp.task("dependencyScriptsAndStyles", [], function () {
gulp.src(dependencyScripts)
.pipe(newer("scripts/dependencies.min.js"))
.pipe(uglify())
.pipe(concat("dependencies.min.js"))
.pipe(gulp.dest("scripts/"));
gulp.src(dependencyStylesheets)
.pipe(newer("styles/dependencies.css"))
//.pipe(minifycss())
.pipe(concat("dependencies.css"))
.pipe(gulp.dest("styles/"));
gulp.src(bootstrapFonts)
.pipe(changed("fonts/"))
.pipe(gulp.dest("fonts/"));
//gulp.src(uiGridResources)
// .pipe(changed("wwwroot/styles/"))
// .pipe(gulp.dest("wwwroot/styles/"));
});
gulp.task("sass", [], function () {
//gulp.src(customStylesheets)
// .pipe(newer("wwwroot/styles/styles.min.css"))
// .pipe(sass({
// sourcemap: true, sourcemapPath: "wwwroot/components/styles"
// }))
// .pipe(minifycss())
// .pipe(concat("styles.min.css"))
// .pipe(gulp.dest("wwwroot/styles/"));
gulp.src(customStylesheets)
.pipe(newer("styles/styles.css"))
.pipe(sass())
.pipe(concat("styles.css"))
.pipe(gulp.dest("styles/"));
});
gulp.task("sass:watch", function () {
gulp.watch(customStylesheets, ["sass"]);
});
gulp.task("typescript", [], function () {
return gulp.src(typescriptFiles)
.pipe(newer("scripts/application.js"))
.pipe(sourcemaps.init())
.pipe(ts({
noImplicitAny: true,
out: "application.js"
}))
.pipe(sourcemaps.write("./maps"))
.pipe(gulp.dest("scripts"));
});
gulp.task("typescript:watch", function () {
gulp.watch(typescriptFiles, ["typescript"]);
});
//Set a default tasks
gulp.task("default", ["clean", "dependencyScriptsAndStyles", "sass"], function () { });