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: change template container id to prevent clashes #859

Merged
merged 1 commit into from
Mar 21, 2018
Merged
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
2 changes: 1 addition & 1 deletion scripts/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="app"></div>
<div id="rsg-root"></div>
</body>
</html>
12 changes: 11 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ let codeRevision = 0;
const render = () => {
// eslint-disable-next-line import/no-unresolved
const styleguide = require('!!../loaders/styleguide-loader!./index.js');
ReactDOM.render(renderStyleguide(styleguide, codeRevision), document.getElementById('app'));
let containerId = 'rsg-root';

if (document.getElementById('app')) {
// eslint-disable-next-line no-console
console.warn(
"The use of 'app' element id in the template is deprecated. Please, update your template file to use 'rsg-root' as the container id."
);
containerId = 'app';
}

ReactDOM.render(renderStyleguide(styleguide, codeRevision), document.getElementById(containerId));
};

window.addEventListener('hashchange', render);
Expand Down