From 4fdfc5e331551ba853719bf02e7f033c59185329 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 8 Feb 2022 20:29:39 +0300 Subject: [PATCH] Merge pull request #5172 from blockscout/js-optimizations Reducing the size of JS bundles --- CHANGELOG.md | 1 + apps/block_scout_web/assets/js/app.js | 1 - .../js/view_specific/address_contract/code_highlighting.js | 7 +++---- .../assets/js/view_specific/raw_trace/code_highlighting.js | 7 +++---- .../lib/block_scout_web/templates/layout/app.html.eex | 3 ++- .../lib/block_scout_web/templates/stakes/index.html.eex | 3 ++- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 766b2013b067..eb4731dd972b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - [#5160](https://github.com/blockscout/blockscout/pull/5160) - Fix blocks validated hint - [#5155](https://github.com/blockscout/blockscout/pull/5155) - Fix get_implementation_abi_from_proxy/2 implementation - [#5154](https://github.com/blockscout/blockscout/pull/5154) - Fix token counters bug +- [#4701](https://github.com/blockscout/blockscout/pull/4701) - Reduced the size of js bundles ### Chore - [#5171](https://github.com/blockscout/blockscout/pull/5171) - Replace lodash NPM package with tiny lodash modules diff --git a/apps/block_scout_web/assets/js/app.js b/apps/block_scout_web/assets/js/app.js index e0971e349514..df99725add04 100644 --- a/apps/block_scout_web/assets/js/app.js +++ b/apps/block_scout_web/assets/js/app.js @@ -21,7 +21,6 @@ import './locale' import './pages/layout' import './pages/dark-mode-switcher' -import './pages/stakes' import './lib/clipboard_buttons' import './lib/currency' diff --git a/apps/block_scout_web/assets/js/view_specific/address_contract/code_highlighting.js b/apps/block_scout_web/assets/js/view_specific/address_contract/code_highlighting.js index 2ffb1efa6fd9..52569303aabb 100644 --- a/apps/block_scout_web/assets/js/view_specific/address_contract/code_highlighting.js +++ b/apps/block_scout_web/assets/js/view_specific/address_contract/code_highlighting.js @@ -1,7 +1,6 @@ -import $ from 'jquery' -import hljs from 'highlight.js' +import hljs from 'highlight.js/lib/core' // only activate highlighting on pages with this selector -if ($('[data-activate-highlight]').length > 0) { - hljs.initHighlightingOnLoad() +if (document.querySelectorAll('[data-activate-highlight]').length > 0) { + hljs.highlightAll() } diff --git a/apps/block_scout_web/assets/js/view_specific/raw_trace/code_highlighting.js b/apps/block_scout_web/assets/js/view_specific/raw_trace/code_highlighting.js index 2ffb1efa6fd9..52569303aabb 100644 --- a/apps/block_scout_web/assets/js/view_specific/raw_trace/code_highlighting.js +++ b/apps/block_scout_web/assets/js/view_specific/raw_trace/code_highlighting.js @@ -1,7 +1,6 @@ -import $ from 'jquery' -import hljs from 'highlight.js' +import hljs from 'highlight.js/lib/core' // only activate highlighting on pages with this selector -if ($('[data-activate-highlight]').length > 0) { - hljs.initHighlightingOnLoad() +if (document.querySelectorAll('[data-activate-highlight]').length > 0) { + hljs.highlightAll() } diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex index ded40c37c40b..ab9a14fa6427 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/app.html.eex @@ -232,7 +232,8 @@ @view_module != Elixir.BlockScoutWeb.APIDocsView && @view_module != Elixir.BlockScoutWeb.Admin.DashboardView && @view_module != Elixir.BlockScoutWeb.SearchView && - @view_module != Elixir.BlockScoutWeb.AddressContractVerificationViaStandardJsonInputView + @view_module != Elixir.BlockScoutWeb.AddressContractVerificationViaStandardJsonInputView && + @view_module != Elixir.BlockScoutWeb.StakesView ) do %> <% end %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/stakes/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/stakes/index.html.eex index 50cc1b6f1d4d..cc9fccd739b5 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/stakes/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/stakes/index.html.eex @@ -49,4 +49,5 @@ -
\ No newline at end of file +
+ \ No newline at end of file