-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvg2svelte.js
executable file
·40 lines (38 loc) · 1 KB
/
svg2svelte.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
#!/usr/bin/env node
import path from 'path'
import { fileURLToPath } from 'url'
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
import convert from './index.js'
const argv = yargs(hideBin(process.argv))
.command(
'$0 <input> <output>',
'Convert a svg file to a svelte component.',
args =>
args
.positional('input', {
type: 'string',
describe: 'svg input file path'
})
.positional('output', {
type: 'string',
describe: 'svelte output file path'
})
.option('ts', {
type: 'boolean',
describe: 'typescript'
})
.option('config', {
alias: 'c',
describe: 'svgo config file path',
default: path.join(
fileURLToPath(import.meta.url),
'..',
'svgo.config.js'
)
})
.example('svg2svelte menu.svg IconMenu.svelte')
)
.help()
.parse()
convert(argv.input, argv.output, argv.ts, argv.config)