forked from pradyunsg/furo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
44 lines (37 loc) · 1.36 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
// Only used to build our CSS/JS. We use sphinx-autobuild to actually
// serve the generated Sphinx documentation during development.
var gulp = require("gulp");
var concat = require("gulp-concat");
var postcss = require("gulp-postcss");
var rename = require("gulp-rename");
var sass = require("gulp-sass");
var sourcemaps = require("gulp-sourcemaps");
var uglify = require("gulp-uglify");
var Fiber = require("fibers");
sass.compiler = require("sass");
var autoprefixer = require("autoprefixer");
var cssnano = require("cssnano");
var easyImport = require("postcss-easy-import");
var plugins = [easyImport(), autoprefixer(), cssnano()];
var src_path = "./src/furo/assets/";
var dest_path = "./src/furo/theme/static";
function css() {
return gulp
.src(src_path + "styles/[!_]*.sass", { since: gulp.lastRun(css) })
.pipe(sourcemaps.init())
.pipe(sass({ fiber: Fiber }).on("error", sass.logError))
.pipe(postcss(plugins))
.pipe(rename({ dirname: "styles", extname: ".css" }))
.pipe(sourcemaps.write(""))
.pipe(gulp.dest(dest_path));
}
function javascript(cb) {
return gulp
.src(src_path + "scripts/[!_]*.js", { since: gulp.lastRun(javascript) })
.pipe(sourcemaps.init())
.pipe(concat("scripts/main.js"))
.pipe(uglify())
.pipe(sourcemaps.write(""))
.pipe(gulp.dest(dest_path));
}
exports.build = gulp.parallel(javascript, css);