diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-03-01 02:21:08 -0600 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-03-01 02:21:08 -0600 |
commit | 3cbebe930936edd4737c560504f698ee81daff56 (patch) | |
tree | 8bc6ece20548e8a3e8663548439696176192a5ae | |
parent | 154fc7dcb67c12ba833cd71208cc49de97f1e963 (diff) | |
download | gitlab-ce-3cbebe930936edd4737c560504f698ee81daff56.tar.gz |
migrate stl_viewer to dynamic importremove-blob-viewer-bundles
-rw-r--r-- | app/assets/javascripts/blob/stl_viewer.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/blob/viewer/index.js | 3 | ||||
-rw-r--r-- | app/views/projects/blob/viewers/_stl.html.haml | 3 | ||||
-rw-r--r-- | config/webpack.config.js | 1 |
4 files changed, 5 insertions, 6 deletions
diff --git a/app/assets/javascripts/blob/stl_viewer.js b/app/assets/javascripts/blob/stl_viewer.js index f611c4fe640..63236b6477f 100644 --- a/app/assets/javascripts/blob/stl_viewer.js +++ b/app/assets/javascripts/blob/stl_viewer.js @@ -1,6 +1,6 @@ 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); }); }); -}); +}; diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index ac18e6fb9f9..92ea91c45a8 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -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; } diff --git a/app/views/projects/blob/viewers/_stl.html.haml b/app/views/projects/blob/viewers/_stl.html.haml index e58809ec008..55dd8cba7fe 100644 --- a/app/views/projects/blob/viewers/_stl.html.haml +++ b/app/views/projects/blob/viewers/_stl.html.haml @@ -1,6 +1,3 @@ -- 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') diff --git a/config/webpack.config.js b/config/webpack.config.js index 37bf5cec97a..22bcf36a974 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -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', |