Commit 96bca13f authored by Mike Greiling's avatar Mike Greiling
Browse files

migrate stl_viewer to dynamic import

parent ddfe028219cd
import Renderer from './3d_viewer';
document.addEventListener('DOMContentLoaded', () => {
export default () => {
const viewer = new Renderer(document.getElementById('js-stl-viewer'));
[].slice.call(document.querySelectorAll('.js-material-changer')).forEach((el) => {
......@@ -16,4 +16,4 @@ document.addEventListener('DOMContentLoaded', () => {
viewer.changeObjectMaterials(target.dataset.type);
});
});
});
};
......@@ -41,6 +41,9 @@ export default class BlobViewer {
case 'sketch':
initViewer(import(/* webpackChunkName: 'sketch_viewer' */ '../sketch_viewer'));
break;
case 'stl':
initViewer(import(/* webpackChunkName: 'stl_viewer' */ '../stl_viewer'));
break;
default:
break;
}
......
- content_for :page_specific_javascripts do
= webpack_bundle_tag('stl_viewer')
.file-content.is-stl-loading
.text-center#js-stl-viewer{ data: { endpoint: blob_raw_path } }
= icon('spinner spin 2x', class: 'prepend-top-default append-bottom-default', 'aria-hidden' => 'true', 'aria-label' => 'Loading')
......
......@@ -47,7 +47,6 @@ function generateEntries() {
mr_notes: './mr_notes/index.js',
protected_branches: './protected_branches',
registry_list: './registry/index.js',
stl_viewer: './blob/stl_viewer.js',
terminal: './terminal/terminal_bundle.js',
two_factor_auth: './two_factor_auth.js',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment