webtreemap icon indicating copy to clipboard operation
webtreemap copied to clipboard

Calling `webtreemap.render` twice adds second `style` tag

Open nikolay-borzov opened this issue 5 years ago • 2 comments

Use case - render a different map on bundle select in drop-down. Like in https://github.com/danvk/source-map-explorer. Maybe it's better to place css in a separate file? Another solution - clear container content

nikolay-borzov avatar May 12 '19 09:05 nikolay-borzov

I think clearing the container content is the best option.

In the first version of webtreemap I had the CSS in a different file, but it becomes cumbersome to integrate into apps -- you end up needing to have the app copy and paste the CSS, which then means we can't make changes to the CSS across versions and so on. If you had any other ideas I'm open to them.

evmar avatar May 12 '19 16:05 evmar

Separate CSS file worked just fine for my case. I already inject webtreemap js into HTML template anyway. We just paste content of webtreemap.js into generated HTML file.

For now, clearing container should work as well.

nikolay-borzov avatar May 12 '19 16:05 nikolay-borzov