nodecg/vite-plugin-nodecg

Support other template configurations

Dan-Shields opened this issue · 0 comments

Right now you're forced to use the hard coded template files src/graphics/template.html and src/dashboard/template.html. It would be nice for this to be configurable. This should be included as part of the plugin's function signature and could look like:

NodeCGPlugin({
    graphicsTemplate: './templates/graphics.html',
    dashboardTemplate: './templates/dashboard.html'
})

To support more complex setups, a config could use globbing to match entry files with templates. It could look like:

NodeCGPlugin({
    './src/graphics/**.ts': './templates/graphics.html',
    './src/dashboard/specificPanel.ts': './templates/specificPanel.html',
    './src/dashboard/**.ts': './templates/dashboard.html',
})

It would default to the following to avoid a breaking change:

{
    './src/graphics/**.ts': './src/graphics/template.html',
    './src/dashboard/**.ts': './src/dashboard/template.html'
}

Thoughts on this would be appreciated.