Skip to content

Commit

Permalink
feat(packages/sui-svg): allow setting custom base path for svg icons …
Browse files Browse the repository at this point in the history
…build (vite)
  • Loading branch information
kikoruiz committed Oct 23, 2024
1 parent df7d92e commit b00b1f7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/sui-svg/bin/sui-svg-dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,33 @@
import {resolve} from 'path'

import {build} from 'vite'
import program from 'commander'

const {pathname: root} = new URL('../src', import.meta.url)

const outDir = resolve(process.cwd(), './public')
const icons = resolve(process.cwd(), 'lib', '_demo.js')

const DEFAULT_BASE = '/'

console.log('[sui-svg] Preparing build with icons...')

program
.option('-b, --base [path]', 'Base public path')
.on('--help', () => {
console.log(' Examples:')
console.log('')
console.log(' $ sui-svg dist')
console.log(' $ sui-svg dist --base /my/abslotute/public/path')
console.log(' $ sui-svg dist --base https://my.full.url/public/path')
console.log('')
})
.parse(process.argv)

const {base = DEFAULT_BASE} = program.opts()

await build({
base,
root,
optimizeDeps: {
include: ['classnames', 'prop-types', 'react', 'react/jsx-runtime', 'react-dom']
Expand Down

0 comments on commit b00b1f7

Please sign in to comment.