Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to combine js files and cs files


  • nanchante
    Participant

    @nanchante

    Hi all,

    Firstly, let me say how grateful I am for such a fantastic mod to WP. Cudos to everyone involved.

    I want to be able to combine all js, and css (separately) for page load speed reasons.

    The result will look something like

    script src=”/combine.php?type=javascript&files=/path-to-file-1.js,/path-to-file-2.js,/path-to-file-3.js,/path-to-file-4.js,” type=”text/javascript”></script

    Css much the same.

    What do I need to modify (I assume in class.wp-scritps.php ?) in order to achieve this.

    Currently I have 30 odd calls to css and js, and this is hurting useablility.

    Many thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I recommend that you use W3 Total Cache; specifically, it’s minify option.


    nanchante
    Participant

    @nanchante

    I am, but it does not combine js or css.

    There are still 20 odd js calls.

    I have not enabled page cache of course as that doesn’t work with BP, correct?

    Minify is enabled, but it does not compress the files for gzip.


    r-a-y
    Keymaster

    @r-a-y

    Currently, in W3 Total Cache, you have to manually add the JS into a group. Same for CSS.
    Make sure you use relative links when adding the JS to a group (eg. wp-content/plugins/xxx/xxx.js)

    W3 Total Cache v0.9 (currently in development) is said to make this much easier.


    nanchante
    Participant

    @nanchante

    where do i do this please?

    and you mean a group of js files, not a buddypress group, rt?


    nanchante
    Participant

    @nanchante

    … and will it gzip too?


    LPH2005
    Participant

    @lph2005

    domain.com/wp-admin/options-general.php?page=w3-total-cache/w3-total-cache.php

    The development version provides a nice list of links across the top.

    General | Page Cache | Minify | Database Cache | Object Cache | Browser Cache | User Agent Groups | Content Delivery Network | FAQ | Support | Install | About

    Choose Minify to combine the js and css scripts.


    r-a-y
    Keymaster

    @r-a-y

    Follow LPH’s advice.

    The section you’re looking for is “JS File Management” and “CSS File Management”. Start manually adding JS /CSS files to a group and save. Make sure you apply the .htaccess edits when W3TC prompts you for them.


    nanchante
    Participant

    @nanchante

    yes, found it i think. Thanks very much.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to combine js files and cs files’ is closed to new replies.
Skip to toolbar