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

feat(gatsby-script): Inline scripts #35443

Merged
merged 12 commits into from
Apr 19, 2022

Conversation

tyhopp
Copy link
Contributor

@tyhopp tyhopp commented Apr 18, 2022

Description

Inline script support for usage with dangerouslySetInnerHTML and template literals:

<Script dangerouslySetInnerHTML={{ __html: `alert('Hello world')` }} />
<Script>{`alert('Hello world')`}</Script>

All currently implemented strategies (pre-hydrate, post-hydrate, idle) are supported.

Todo

  • Canary released and e2e site updated to use it

Documentation

Documentation will be added in a later PR.

Related Issues

[sc-48942]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 18, 2022
@tyhopp tyhopp added this to the Script Component milestone Apr 18, 2022
@tyhopp tyhopp added topic: performance Related to runtime & build performance type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Apr 18, 2022
@tyhopp tyhopp merged commit 954b267 into feat-script-component Apr 19, 2022
@tyhopp tyhopp deleted the feat-script-component-inline-scripts branch April 19, 2022 04:53
@tyhopp tyhopp mentioned this pull request Apr 19, 2022
12 tasks
tyhopp added a commit that referenced this pull request May 9, 2022
* feat(gatsby-script): Implement inline scripts

* test(gatsby-script): Inline scripts unit tests

* test(gatsby-script): Set up for e2e tests

* test(gatsby-script): Display scripts with sources strategy

* test(gatsby-script): dangerouslySetInnerHTML e2e tests

* test(gatsby-script): Template literals e2e tests

* chore(gatsby-script): Update package readme

* chore(gatsby-script): Install latest canary to run in CI

* chore(gatsby-script): Try waitForRouteChange to fix inconsistent Cypress network waits

* chore(gatsby-script): Try delaying responses so Cypress has time to set up network waits

* chore(gatsby-script): Try increasing network response delay even further

* chore(gatsby-script): Remove unreliable Cypress network waits entirely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) topic: performance Related to runtime & build performance type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant