Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to combine js files and cs files

  • @nanchante

    Participant

    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)
  • @djpaul

    Keymaster

    I recommend that you use W3 Total Cache; specifically, it’s minify option.

    @nanchante

    Participant

    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

    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

    where do i do this please?

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

    @nanchante

    Participant

    … and will it gzip too?

    @lph2005

    Participant

    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

    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

    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