I have a project that uses a lot of template strings, that I want to convert to separate HTML files.
I know Visual Studio Code can move JavaScript to a new file. Can it do the same with HTML string content?
The closest I can do is extract the JavaScript string to a new file, and then rename it and change the extension.
I've not found an issue in the Visual Studio Code GitHub account or any other questions about this.
So I want to go from this:
const MY_TEMPLATE = `<div>{{unicorn.fart()}}</div>`
function useTemplate(imports){
return {
template: MY_TEMPLATE,
scope: {
unicorn: imports.getUnicorn('charlie')
onFart: imports.refuelCar(imports.ELECTRIC_CAR)
}
}
}
Highlight the string in the MY_TEMPLATE select a right click menu, and then get this:
import template from './MY_TEMPLATE.html'
function useTemplate(imports){
return {
template,
scope: {
unicorn: imports.getUnicorn('charlie')
onFart: imports.refuelCar(imports.ELECTRIC_CAR)
}
}
}
Is there a setting to change, a version to install/wait for or a plugin?