-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
esbuild.js
executable file
·36 lines (30 loc) · 991 Bytes
/
esbuild.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
// @ts-check
const path = require('path')
const fs = require('fs')
const esbuild = require('esbuild')
fs.existsSync(path.join(__dirname, 'gen')) &&
fs.rmSync(path.join(__dirname, 'gen'), { recursive: true, force: true })
require('zotero-plugin/copy-assets')
require('zotero-plugin/version')
require('zotero-plugin/rdf')
const { sassPlugin } = require('esbuild-sass-plugin')
const sass = require('sass')
async function build() {
await esbuild.build({
bundle: true,
format: 'iife',
target: ['firefox60'],
entryPoints: ['content/zotero-night.ts'],
outdir: 'build/content',
color: true,
plugins: [sassPlugin({ type: 'css-text' })],
})
const nightCss = sass.compile('css/night.scss')
fs.existsSync(path.join(__dirname, 'build/skin')) ||
fs.mkdirSync(path.join(__dirname, 'build/skin'), { recursive: true })
fs.writeFileSync(path.join('build', 'skin', 'night.css'), nightCss.css)
}
build().catch((err) => {
console.log(err)
process.exit(1)
})