Skip to content

Use uglify plugin instead of "immutable" string function for HTML toggle content function #26

@itsalb3rt

Description

@itsalb3rt

Is your feature request related to a problem? Please describe.
Use modern solution for prevent webpack transpilation of necessary function for final documentation page.

// src/assets/js/TableOfContentUtil.js
/**
 * Prevent webpack transpilation
 */
const inmutableToggleContent = `
window.onload = function () {
  window.toggleContent = function (idEl, iconContainer) {
    const content = document.querySelector('#' + idEl)

    if (content.classList.contains('hide')) {
      iconContainer.textContent = '▼'
      content.classList.add('show')
      content.classList.remove('hide')
    } else if (content.classList.contains('show')) {
      iconContainer.textContent = '►'
      content.classList.add('hide')
      content.classList.remove('show')
    } else {
      content.classList.add('show')
    }
  }
}
`

Describe the solution you'd like
Use this plugin:
https://www.npmjs.com/package/uglifyjs-webpack-plugin

Following the quasar documentation:
https://quasar.dev/quasar-cli/handling-webpack

https://forum.quasar-framework.org/topic/5151/solved-how-to-add-a-webpack-plugin-and-require-file

Describe alternatives you've considered
NONE

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions