+ Reply to Thread
Results 1 to 3 of 3

Thread: is it possible to move some of the javascript and css from each html page to files?

  1. #1
    Senior Member
    Join Date
    Dec 2023
    Posts
    161

    is it possible to move some of the javascript and css from each html page to files?

    I notice on the nova template, there is quite a bit of javascript and css code in each output html page. Is it possible to move the javascript and/or css to a separate file?

    For example the 136 lines of javascript that begins with
    Code:
    Only registered members can view the code.

    And below it the 254 lines of css that begins
    Code:
    Only registered members can view the code.
    Or is there a reason that those two for example are better to output in each individual html page instead of called with an src for the js or included in a css file that can be cached/optimized?

    I suspect the reason may be simplicity of activating/updating plugins...but I'm wondering if there is or could be a tutorial on optimizing the html output by moving those into optimized/cached files.

    I'm trying to get a good report on Google Page Speed Insights mobile.
    Last edited by Horizon; January 11, 2024 at 09:25 AM.

  2. #2
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,174
    Hello,

    Unfortunately, it's not possible for some js code because it initializes variables given from php at the beginning of the page

    and some plugins embed their code directly into the page during the page-building

  3. #3
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Regarding the inline js, I wonder how difficult it would be to minify the javascript in the output public html?

    Regarding the inline css, I can see how the inline css might make it easier to update plugins, but it sure would be nice to have all those lines in a cached file, plus if I were to want to customize one of those bits, it makes it more difficult if those bits of css are scattered in the plugins rather than in a master style file. I don't think this is something that is super important, but just my wishlist item for the future I guess.

    I'm looking for ways to improve the google page speed insights reports, but maybe I'll start a separate thread to see if there are other more beneficial ways to do that.

+ Reply to Thread