-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fixes #5244 Add examples component #5463
Conversation
✅ Deploy Preview for prebid-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Add a separate info box in the example layout that explains that the |
Feedback
|
Check the debugging module if there are some examples that could benefit as well: |
this is still missing the prebid.js and other javascripts that might be necessary
All Feedback implemented.
|
- id: unique id for the example | ||
- html: html code snippet | ||
- js: js code snippet | ||
- scripts: a commad separate list of required scripts. Allowed values are pbjs,gpt,astjs . default is pbjs,ast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the scripts
include an example can specify the scripts required for this example. I chose a sensible default that most examples use
{% assign scripts = include.scripts | split: "," %}{% for script in scripts %}{% if script == "pbjs" %}<script async src="https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js"></script> | ||
{% elsif script == "gpt" %}<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script> | ||
{% elsif script == "astjs" %}<script async src="https://acdn.adnxs.com/ast/ast.js"></script>{% else %}<!-- unknown script tag '{{ script }}' required -->{% endif %}{% else %}<script async src="//cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js"></script> | ||
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>{% endfor %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ugly in code, but nicer on the page: a lot less whitespace
{% endcapture %} | ||
|
||
{% include code/web-example.html id="basic-prebid-example" html=htmlCodePrebid js=jsCode scripts="pbjs,astjs" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example for a different scripts
attribute
@ChrisHuie you are a master 🙏 |
Adds a new include that replaces JS Fiddle.
🏷 Type of documentation
📋 Checklist
Usage
See the demo page on how it works and looks like.
https://deploy-preview-5463--prebid-docs-preview.netlify.app/docs-examples/web-example.html