-
Notifications
You must be signed in to change notification settings - Fork 317
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
New command: generate SPFx package #2367
Comments
@pnp/cli-for-microsoft-365-maintainers I'd appreciate your feedback |
Should we have switches to isolate css, allow/disallow scripts? |
Since the web part embeds the predefined HTML snippet and doesn't allow users to change it after adding the web part on the page, I don't think we need the requires custom script flag. As for CSS, would you see users specify a separate link tag that would be added to the head section of the page or could they include it along with the HTML snippet and it would be added to the body? |
In many ways I think I envision wrapping the scripted wp - but at the same time adding options for isolation as we have in the markup for the search wp do make sense. The isolation spectrum is a scale sort of. |
Ah, so you mean to introduce a flag that allows producing an isolated web part? |
That's an option...was more thinking css santization for onpage embedding. But multiple options to look at for sure. |
How would you see us do CSS isolation? |
@waldekmastykarz For modern search we add a random container ID at the top, and merge whatever CSS you have in your below that parent. This ensures you cannot influence CSS upwards/outside from your markup. |
Since we're not using .scss, wouldn't that mean though, that we need to update all CSS selectors to the web part div/parent container? Also, if you'd include a |
Good point, and it's input to what we could add. But for the first version let's do KISS :) There are multiple ways to handle links, you could let the browser handle them, or you parse them out and load them using code - giving you parsing control. |
Like you said, let's start simple, gauge interest and evolve. |
I like the spec, however I'm curious about the |
@garrytrinder could be either one or both, so maybe some enum option. |
Originally I thought about a simple switch to do both, like you mentioned @garrytrinder. Not sure if it's necessary for us to let users choose or if we simply offer them an easy way out. Whichever you think would be more valuable. |
I think it's always good to give the user the option and be more explicit. I agree with @wobba either one or both would be my preferred option. |
I've updated the spec to let user specify how the web part should be exposed in Teams |
Awesome! :) |
Original idea by @wobba
Usage
spfx package generate [options]
Description
Generates SharePoint Framework solution package with a no-framework web part rendering the specified HTML snippet.
Options
-t, --webPartTitle <webPartTitle>
-d, --webPartDescription <webPartDescription>
-n, --packageName <packageName>
--html <html>
--enableForTeams [enableForTeams]
tab
,personalApp
,all
--developerName [developerName]
Contoso
--developerPrivacyUrl [developerPrivacyUrl]
https://contoso.com/privacy
--developerTermsOfUseUrl [developerTermsOfUseUrl]
https://contoso.com/terms-of-use
--developerWebsiteUrl [developerWebsiteUrl]
https://contoso.com/my-app
--developerMpnId [developerMpnId]
000000
Additional Information
This command is meant to quickly generate a SharePoint Framework solution package with a web part that renders the specified HTML fragment. It's meant for cases, when you want to embed a piece of HTML in Microsoft Teams or your SharePoint portal but don't want to create a whole SharePoint Framework project.
The text was updated successfully, but these errors were encountered: