-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.cjs
55 lines (45 loc) · 1.46 KB
/
gulpfile.cjs
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
// Copyright 2024 @polkadot-ui/recipes authors & contributors
// SPDX-License-Identifier: MIT
/* eslint-disable @typescript-eslint/no-var-requires */
const gulp = require("gulp");
const ts = require("gulp-typescript");
const strip = require("gulp-strip-comments");
const sourcemaps = require("gulp-sourcemaps");
const merge = require("merge-stream");
const sass = require("gulp-sass")(require("sass"));
const lrserver = require("tiny-lr")();
const refresh = require("gulp-livereload");
const SASS_OPTIONS = { outputStyle: "compressed" };
const replace = require("gulp-replace");
const { src, dest, series } = gulp;
const buildComponents = () => {
var tsProject = ts.createProject("tsconfig.json");
var tsResult = tsProject.src().pipe(sourcemaps.init()).pipe(tsProject());
return merge(tsResult, tsResult.js)
.pipe(sourcemaps.write("."))
.pipe(dest("dist"));
};
const buildCss = () => {
return src("lib/**/*.scss")
.pipe(sass(SASS_OPTIONS))
.pipe(dest("dist"))
.pipe(refresh(lrserver));
};
const replaceCss = () => {
return src(["dist/**/*.d.ts", "dist/**/*.js", "dist/**/*.map"])
.pipe(replace(".scss", ".css"))
.pipe(dest("dist"));
};
const stripComments = () => {
return src("dist/**/*.js").pipe(strip()).pipe(dest("dist"));
};
const licenseAndReadme = () => {
return src(["LICENSE", "README.npm.md"]).pipe(dest("dist"));
};
exports.default = series(
buildComponents,
buildCss,
replaceCss,
stripComments,
licenseAndReadme,
);