diff --git a/backend/backend/static/js/app.js b/backend/backend/static/js/app.js index 6fa6a1d19..98a16501e 100644 --- a/backend/backend/static/js/app.js +++ b/backend/backend/static/js/app.js @@ -2,16 +2,11 @@ import "../scss/app.scss"; // Global -import "./modules/bootstrap"; -import "./modules/feather"; +import "bootstrap"; import "./modules/font-awesome"; -import "./modules/moment"; import "./modules/sidebar"; import "./modules/user-agent"; -// Charts -import "./modules/chartjs"; - // Forms import "./modules/mask"; import "Select2/select2.js"; @@ -21,7 +16,11 @@ import "./modules/validation"; import "./modules/datatables"; // Code highlight -import hljs from 'highlight.js'; +import hljs from 'highlight.js/lib/highlight'; +import bash from 'highlight.js/lib/languages/bash'; +hljs.registerLanguage('bash', bash); + + window.hljs = hljs; // Tags @@ -41,3 +40,6 @@ window.mixpanel = require('mixpanel-browser'); import Shepherd from 'shepherd.js' window.Shepherd = Shepherd; + +import feather from "feather-icons"; +window.feather = feather; \ No newline at end of file diff --git a/backend/backend/static/js/modules/font-awesome.js b/backend/backend/static/js/modules/font-awesome.js index b125deb40..e7e43e856 100644 --- a/backend/backend/static/js/modules/font-awesome.js +++ b/backend/backend/static/js/modules/font-awesome.js @@ -1 +1,21 @@ -import "@fortawesome/fontawesome-free/js/all"; +import { library, dom } from '@fortawesome/fontawesome-svg-core' + +/* + Webpack fails to properly tree-shake Fontawesome's index.es.js, see + https://github.com/FortAwesome/Font-Awesome/issues/14552 + This workaround helps reduce bundle size by 600+ KiB, + */ +import { faSquare } from '@fortawesome/free-regular-svg-icons/faSquare' +import { faCheckSquare } from '@fortawesome/free-regular-svg-icons/faCheckSquare' +import { faCopy } from '@fortawesome/free-solid-svg-icons/faCopy' +import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck' +import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons/faQuestionCircle' +import { faExclamationCircle } from '@fortawesome/free-solid-svg-icons/faExclamationCircle' +import { faEdit } from '@fortawesome/free-solid-svg-icons/faEdit' +import { faSave } from '@fortawesome/free-solid-svg-icons/faSave' +import { faEye } from '@fortawesome/free-solid-svg-icons/faEye' +import { faInfoCircle } from '@fortawesome/free-solid-svg-icons/faInfoCircle' + + +library.add([faCopy, faCheck, faQuestionCircle, faExclamationCircle, faEdit, faSquare, faCheckSquare, faSave, faEye, faInfoCircle]); +dom.watch(); diff --git a/backend/device_registry/context_processors.py b/backend/device_registry/context_processors.py index f664cf603..8a5726a24 100644 --- a/backend/device_registry/context_processors.py +++ b/backend/device_registry/context_processors.py @@ -8,7 +8,7 @@ webpack_stats_path = Path(settings.BASE_DIR) / '..' / WEBPACK_STATS_NAME with webpack_stats_path.open() as webpack_stats_file: webpack_bundle_json = json.load(webpack_stats_file) - WEBPACK_BUNDLE_CSS, WEBPACK_BUNDLE_JS = ['/bundles/'+chunk['name'] for chunk in webpack_bundle_json['chunks']['app']] + WEBPACK_BUNDLE_CSS, WEBPACK_BUNDLE_JS = ['/bundles/'+chunk['name'] for chunk in webpack_bundle_json['chunks']['app']][:2] def webpack_bundle(request): diff --git a/backend/device_registry/templates/admin_base.html b/backend/device_registry/templates/admin_base.html index 58e7799cf..a093365af 100644 --- a/backend/device_registry/templates/admin_base.html +++ b/backend/device_registry/templates/admin_base.html @@ -48,11 +48,8 @@ {% endblock dashboard_title %}