Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use init options usePlatformScripts and usePlatformStyles like vss-web-extension-sdk? #30

Open
yunsii opened this issue Jul 20, 2020 · 5 comments

Comments

@yunsii
Copy link

yunsii commented Jul 20, 2020

No description provided.

@FlexiGit
Copy link

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)

@yunsii
Copy link
Author

yunsii commented Aug 10, 2020

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?

@FlexiGit
Copy link

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.

@yunsii
Copy link
Author

yunsii commented Aug 10, 2020

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 #17, it's impossible to develop dashboard widget with new sdk. So I decided to develop dashboard widget with old sdk.

@htekdev
Copy link

htekdev commented May 20, 2022

@yunsii checkout my comment over here: #22 (comment)

Just opened a PR for the integration between both since it's a reoccurring problem.
#51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants