Support » Plugin: Autoptimize » mathjax series js files not working well

  • Resolved powercliff

    (@powercliff)


    hello,

    (Maybe it is a special condition, and I don’t know how to explain it using scientific terms)
    I have a plugin, ‘mathjax’, which inserts a script tag in every page’s html file: (the Autoptimize JavaScript Options is OFF)

     <script defer='defer'
            src="https://example.com/wp-content/uploads/mathjax/mathjax-2.7.9/package/MathJax.js?config=default&ver=xxxxxxxxxxxxxxxxxxxxx"
            id='mathjax-js'></script>

    I serve a local folder in wp-content/uploads to store all asserts related to mathjax. They works as below:
    The html <script> firstly calls MathJax.js first (as the code describes), and the Mathjax.js calls other related javascript files in the same folder (or sub folders), for example,
    https://example.com/wp-content/uploads/mathjax/mathjax-2.7.9/package/MathJax.js
    https://example.com/wp-content/uploads/mathjax/mathjax-2.7.9/package/fonts/Tex/color.js
    …..
    (many js files)

    Now I turn on the ‘Optimize JavaScript Code’ option, and the html file become :

    <script defer='defer'
            src='https://example.com/wp-content/cache/autoptimize/js/autoptimize_single_xxxxxxxxxxx.js?config=default&ver=xxxxxxxxxxxx'
            id='mathjax-js'></script>

    Then the following javascript calls become massy:
    https://example.com/wp-content/uploads/mathjax/mathjax-2.7.9/package/fonts/Tex/color.js
    All the request urls remove ‘wp-content/uploads/mathjax/mathjax-2.7.9/package’, and they all get 404 errors.

    I think one of the solution is:
    don’t let MathJax.js be packed into the single javascript file, let it be called seperately.
    However, whatever exception rules I write in ‘Exclude scripts from Autoptimize:’, they do not work at all.

    Can you tell me a solution to solve this problem? I have tried to handle it for a long time. Thank you!

    • This topic was modified 4 months, 2 weeks ago by powercliff.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.