-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathrollup.config.js
More file actions
86 lines (84 loc) · 2.32 KB
/
rollup.config.js
File metadata and controls
86 lines (84 loc) · 2.32 KB
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
import resolve from "@rollup/plugin-node-resolve";
import eslint from "@rollup/plugin-eslint";
import scss from "rollup-plugin-scss";
import stylelint from "rollup-plugin-stylelint";
import postcss from "postcss";
import autoprefixer from "autoprefixer";
import copy from "rollup-plugin-copy";
const isProd = process.env.NODE_ENV === "production";
const srcPath = "_src/";
const distPath = "Files/Templates/Designs/Swift-v2/Assets/";
console.log("Building for " + (isProd ? "production" : "development"));
export default [
//Scripts
{
input: srcPath + "js/swift.js",
plugins: [
resolve(),
isProd &&
(await import("@rollup/plugin-terser")).default({
mangle: true,
sourceMap: true,
output: {
comments: false,
},
compress: {
drop_console: true,
},
}),
eslint({
fix: true,
include: srcPath + ["js/**"],
exclude: ["node_modules/**", distPath + "**"],
throwOnError: true,
throwOnWarning: true,
}),
copy({
targets: [
{ src: "node_modules/swiffy-slider/dist/", dest: distPath + "lib/" },
{ src: "node_modules/htmx.org/dist/", dest: distPath + "lib/" },
{ src: "node_modules/bootstrap/dist/", dest: distPath + "lib/" },
{ src: "node_modules/flatpickr/dist/", dest: distPath + "lib/" },
{ src: "node_modules/alpinejs/dist/", dest: distPath + "lib/" },
],
copyOnce: true,
flatten: false,
}),
],
output: [
{
file: distPath + "js/" + "swift.js",
format: "umd",
name: "swift",
},
{
file: distPath + "js/" + "swift.esm.js",
format: "es",
name: "swift",
},
],
},
//Styles
{
input: srcPath + "scss/swift.js",
plugins: [
resolve(),
stylelint.default({
include: srcPath + ["scss/**.scss"],
failOnError: true,
report: true,
}),
scss({
watch: srcPath + "scss",
outputStyle: isProd ? "compressed" : "expanded",
sourceMap: isProd ? true : false,
includePaths: ["node_modules"],
fileName: "swift.css",
processor: () => postcss([autoprefixer()]),
}),
],
output: {
file: distPath + "css/" + "swift.css",
},
},
];