Open yunsii opened 4 years ago
Thanks, @FlexiGit . I got it when I know the new sdk more. It works in most case, But some case is not work very well. I encounter a question: how to use Bowtie font or others static resouces?
Here is my temporary solution:
async function loadBowtieFont() {
const origins = location.ancestorOrigins;
if (origins.length) {
const css = `@font-face {
font-family: 'Bowtie';
src: url('${origins[0]}/_static/tfs/Dev17.M153.5/_content/Fonts/Icons/bowtie.woff') format('woff');
}`,
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
head.appendChild(style);
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
}
}
Maybe CDN is better solution?
Maybe you could have a look at azure-devops-extension-sample. They use webpack to build and package the extension. I employ a similar approach for my extensions.
I had learned azure-devops-extension-sample. It package static resources into extension, but I think it's overstaffed as common resources.
Moreover, according to https://github.com/microsoft/azure-devops-extension-sdk/issues/17, it's impossible to develop dashboard widget with new sdk. So I decided to develop dashboard widget with old sdk.
@yunsii checkout my comment over here: https://github.com/microsoft/azure-devops-extension-sdk/issues/22#issuecomment-1133211928
Just opened a PR for the integration between both since it's a reoccurring problem. https://github.com/microsoft/azure-devops-extension-sdk/pull/51
This sdk doesn't support those options. It is intended to be used in conjunction with the "new" ReactJs based azure-devops-ui.
(Disclaimer: I'm not affiliated with MS and this answer is only based on experimenting)