Skip to content

Commit

Permalink
Better approach: use IIFE
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Apr 20, 2023
1 parent 599f0d4 commit 31062d3
Show file tree
Hide file tree
Showing 4 changed files with 372 additions and 380 deletions.
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ We use web components from https://github.com/Qiskit/web-components to include c
To update the top nav bar web component:

1. In https://github.com/Qiskit/web-components, run `npm install` then `npm run build`.
2. There should be a file created at the root of the repository called `experimental-bundled-ui-shell.js`. Copy its contents into the file `js/web-components/top-nav-bar.js.jinja`.
3. Add back `{% raw %}` to the very top of the file and `{% endraw %}` to the very end.
4. Build the example docs to ensure everything works.
2. There should be a file created at the root of the repository called `experimental-bundled-ui-shell.js`. Copy its contents into the file `js/web-components/top-nav-bar.js.jinja`.
3. Build the example docs to ensure everything works.

If you want to add a new web component:

1. Work with the web components repository to set up `npm run build` to generate a single JavaScript file.
2. Add the file contents to the `js/web-components/` folder. Add `{% raw %}` to the very top of the file and `{% endraw %}` to the very end.
3. Add to the HTML template (e.g. `layout.html`) a line like `<script type="module">{% include "static/js/web-components/top-nav-bar.js.jinja" %}</script>` in the `<head>`.
2. Add the file contents to the `js/web-components/` folder.
3. Add to the HTML template (e.g. `layout.html`) a line like `<script src="{{ pathto('_static/js/web-components/my-component.js', 1) }}"></script>` in the `<head>`.
4. Build the example docs to ensure everything works.
5. Update this guide with specific instructions for the web component.

Expand Down
2 changes: 1 addition & 1 deletion qiskit_sphinx_theme/pytorch_base/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
{%- endfor -%}

<script type="module">{% include "static/js/web-components/top-nav-bar.js.jinja" %}</script>
<script src="{{ pathto('_static/js/web-components/top-nav-bar.js', 1) }}"></script>

<!-- SEGMENT ANALYTICS -->
{%- if analytics_enabled %}
Expand Down
5 changes: 0 additions & 5 deletions qiskit_sphinx_theme/pytorch_base/static/css/theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 31062d3

Please sign in to comment.