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: new optional parameter appMountAttrs #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ To make it work, you need to provide these **required parameters**:

And you can provide some other *optional parameters*:
- `appMountId`: The `<div>` element id on which you plan to mount a JavaScript app.
- `appMountAttrs`: The `<div>` element other attributes that you want to add
(eg `aria-hidden="true"` to solve [ayy1 errors](https://dequeuniversity.com/rules/axe/3.5/region)).
Note that appMountId is required.
- `appMountHtmlSnippet`: A small snippet of HTML that will be inserted in the `<div>` element the appMountId is attached to.
- `appMountIds`: An array of application element ids.
- `baseHref`: Adjust the URL for relative URLs in the document ([MDN](https://developer.mozilla.org/en/docs/Web/HTML/Element/base)).
Expand Down
1 change: 1 addition & 0 deletions examples/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
inject: false,
template: '../index.ejs',
appMountId: 'app',
appMountAttrs: 'aria-hidden="true"',
devServer: 'http://localhost:3001',
googleAnalytics: {
trackingId: 'UA-XXXX-XX',
Expand Down
6 changes: 5 additions & 1 deletion index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ htmlWebpackPlugin.options.scripts = htmlWebpackPlugin.options.scripts || []
} %><%

if (htmlWebpackPlugin.options.appMountId) { %>
<div id="<%= htmlWebpackPlugin.options.appMountId %>"><%
<div id="<%= htmlWebpackPlugin.options.appMountId %>" <%
if (htmlWebpackPlugin.options.appMountAttrs) { %>
<%= htmlWebpackPlugin.options.appMountAttrs %>
<% } %>
> <%
if (htmlWebpackPlugin.options.appMountHtmlSnippet) { %>
<%= htmlWebpackPlugin.options.appMountHtmlSnippet %><%
} %>
Expand Down