generated from 8fold/github-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
132 lines (118 loc) · 3.81 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
const gulp = require("gulp");
const rename = require("gulp-rename");
// const rawDestLocal = "./site-raw/local";
// const rawDestPublic = "./site-raw/public";
const rootDestLocal = "./site-root/local";
const rootDestPublic = "./site-root/public";
// const loreDestLocal = "./site-lore/local";
// const loreDestPublic = "./site-lore/public";
gulp.task("default", (done) => {
console.log('gulp sass: Compiles the CSS');
console.log('gulp javascript: Compiles the JavaScript');
done();
});
/**
* Begin Sass
*/
const sass = require("gulp-dart-scss");
const autoprefixer = require("autoprefixer");
const discardComments = require("postcss-discard-comments");
const csso = require("postcss-csso");
const sourcemaps = require("gulp-sourcemaps");
const postcss = require("gulp-postcss");
gulp.task("sass", (done) => {
const src = "./src/assets/sass/styles.scss";
const pluginsProcess = [discardComments(), autoprefixer()];
const pluginsMinify = [csso({ forceMediaMerge: false })];
gulp
.src(src)
.pipe(sourcemaps.init({ largeFile: true }))
.pipe(
sass({ outputStyle: "expanded" })
.on("error", () => { console.log('ERROR: while compiling Sass') }))
.pipe(postcss(pluginsProcess))
// .pipe(gulp.dest(rawDestLocal + '/css'))
// .pipe(gulp.dest(rawDestPublic + '/css'))
.pipe(gulp.dest(rootDestLocal + '/css'))
.pipe(gulp.dest(rootDestPublic + '/css'))
// .pipe(gulp.dest(loreDestLocal + '/css'))
// .pipe(gulp.dest(loreDestPublic + '/css'))
.pipe(postcss(pluginsMinify))
.pipe(rename({suffix: ".min"}))
.pipe(sourcemaps.write("."))
// .pipe(gulp.dest(rawDestLocal + '/css'))
// .pipe(gulp.dest(rawDestPublic + '/css'))
.pipe(gulp.dest(rootDestLocal + '/css'))
.pipe(gulp.dest(rootDestPublic + '/css'));
// .pipe(gulp.dest(loreDestLocal + '/css'))
// .pipe(gulp.dest(loreDestPublic + '/css'));
done();
});
/**
* Begin javascript
*/
const uglify = require("gulp-uglify");
gulp.task("javascript", (done) => {
const src = "./src/assets/js/interactive.js";
gulp
.src(src)
.pipe(uglify())
.pipe(rename({suffix: ".min"}))
// .pipe(gulp.dest(rawDestLocal + '/js'))
// .pipe(gulp.dest(rawDestPublic + '/js'))
.pipe(gulp.dest(rootDestLocal + '/js'))
.pipe(gulp.dest(rootDestPublic + '/js'));
// .pipe(gulp.dest(loreDestLocal + '/js'))
// .pipe(gulp.dest(loreDestPublic + '/js'));
done();
});
/**
* Begin favicons
*/
gulp.task("favicons", (done) => {
const src = "./src/assets/favicons";
gulp
.src(src + '/**/*')
// .pipe(gulp.dest(rawDestLocal + '/favicons'))
// .pipe(gulp.dest(rawDestPublic + '/favicons'))
.pipe(gulp.dest(rootDestLocal + '/favicons'))
.pipe(gulp.dest(rootDestPublic + '/favicons'));
// .pipe(gulp.dest(loreDestLocal + '/favicons'))
// .pipe(gulp.dest(loreDestPublic + '/favicons'));
done();
});
/**
* Begin ui
*/
gulp.task("ui", (done) => {
const src = "./src/assets/ui";
gulp
.src(src + "/**/*")
// .pipe(gulp.dest(rawDestLocal + "/ui"))
// .pipe(gulp.dest(rawDestPublic + '/ui'))
.pipe(gulp.dest(rootDestLocal + '/ui'))
.pipe(gulp.dest(rootDestPublic + '/ui'));
// .pipe(gulp.dest(loreDestLocal + '/ui'))
// .pipe(gulp.dest(loreDestPublic + '/ui'));
done();
});
/**
* Begin fonts
*/
// gulp.task("fonts", (done) => {
// const src = "./src/assets/fonts";
//
// gulp
// .src(src + "/**/*")
// // .pipe(gulp.dest(rawDestLocal + '/fonts'))
// // .pipe(gulp.dest(rawDestPublic + '/fonts'))
// // .pipe(gulp.dest(rootDestLocal + '/fonts'))
// // .pipe(gulp.dest(rootDestPublic + '/fonts'))
// // .pipe(gulp.dest(loreDestLocal + '/fonts'))
// // .pipe(gulp.dest(loreDestPublic + '/fonts'));
// done();
// });
gulp.task("watch", () => {
gulp.watch("./src/assets/sass/**/*.scss", gulp.series("sass"));
return;
});