WordPress.org

Support

Support » How-To and Troubleshooting » combining CSS & Js into One File.

combining CSS & Js into One File.

  • I am a pretty savvy person when it comes to WP but got stuck on this one. There are plenty of plugins that can accomplish this but I rather do it manually. I have multiple CSS and Js files on my WP theme and I want to be able to generate a one files and make it as the main one.

    For example, for the CSS files I have a couple:

    [ Moderator note: please wrap code in backticks or use the code button. ]

    <link rel='stylesheet'   href='website.com/style1.css'
    <link rel='stylesheet'   href='website.com/style2.css'
    <link rel='stylesheet'   href='website.com/style3.css'
    <link rel='stylesheet'   href='website.com/style4.css'
    <link rel='stylesheet'   href='website.com/style5.css'

    How can I manually combine them to be like this:

    <link rel="stylesheet" href="website.com/style1,style2,style3,style4,style5.css">

    and then get ride of the one I have on the main page right now.

    Same goes for .Js files as well.

    There are plenty of tutorials but none of them is helpful. Thanks a lot for all your help and what you do.

    John

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have tried to do this also with wordpress plugin Total Cache and it caused my site to go down. Is there a manual way, which is theme-friendly and plugin friendly, to force a meld to at least 1 css file and 1 js file. All articles tell you to do this, and I know I can do this manually on a straight up html site, but not with wordpress involved. Its like everything is fighting each other to work. I know plugins are a problem, but holy cow, loading 10 css and js pages is ridiculous. I am at a loss how to make everything work together efficiently to make a speedy mobile friendly site.

    i would suggest to go in baby steps.. try to add couple of css togather then see how it goes then try to add more. and if i were you i would leave the js files as it is for various reasons. To speed up the site i suggest to have the best hosting resource possible and stay updated on Wp version. clean up database, using CDN to load css images and js also helps

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘combining CSS & Js into One File.’ is closed to new replies.
Skip to toolbar