-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2088 from alphagov/implement-script-type-equals-m…
…odule Plugin authors can now use scripts with type module
- Loading branch information
Showing
8 changed files
with
78 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import fooSubmodule from './foo-submodule.js' | ||
|
||
const fooParagraph = document.getElementById('foo-module') | ||
|
||
if (fooParagraph) { | ||
fooParagraph.hidden = false | ||
setTimeout(() => { | ||
fooParagraph.innerHTML = 'The foo result is: ' + fooSubmodule(1, 2) | ||
}, 500) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function fooSubmodule (x, y) { | ||
return x + y | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
<h1 class="test-foo">Plugin Foo</h1> | ||
<p hidden id='foo-module'>calculating</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{% for scriptUrl in pluginConfig.scripts %} | ||
<script src="{{scriptUrl}}"></script> | ||
{% for scriptConfig in pluginConfig.scripts %} | ||
{% if scriptConfig.type|length %} | ||
<script type="{{scriptConfig.type}}" src="{{scriptConfig.src}}"></script> | ||
{% else %} | ||
<script src="{{scriptConfig.src}}"></script> | ||
{% endif %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters