Skip to content

Commit 3ebcc80

Browse files
glebezsapegin
authored andcommitted
Feat: Change template container ID to prevent clashes (#859)
Fixes #753.
1 parent 6055c2b commit 3ebcc80

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

scripts/templates/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
</head>
88
<body>
9-
<div id="app"></div>
9+
<div id="rsg-root"></div>
1010
</body>
1111
</html>

src/index.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ const scrollToOrigin = () => {
1818
const render = () => {
1919
// eslint-disable-next-line import/no-unresolved
2020
const styleguide = require('!!../loaders/styleguide-loader!./index.js');
21-
ReactDOM.render(renderStyleguide(styleguide, codeRevision), document.getElementById('app'));
21+
let containerId = 'rsg-root';
22+
23+
if (document.getElementById('app')) {
24+
// eslint-disable-next-line no-console
25+
console.warn(
26+
"The use of 'app' element id in the template is deprecated. Please, update your template file to use 'rsg-root' as the container id."
27+
);
28+
containerId = 'app';
29+
}
30+
31+
ReactDOM.render(renderStyleguide(styleguide, codeRevision), document.getElementById(containerId));
2232
};
2333

2434
window.addEventListener('hashchange', render);

0 commit comments

Comments
 (0)