Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3494648
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:01:51+00:00 2026-05-18T12:01:51+00:00

I have a website, that uses a lot of jquery/javascript. Now, at the index

  • 0

I have a website, that uses a lot of jquery/javascript. Now, at the index page I have about 10 javascript files included in the head:

<head>
<script src="/js/jquery.js"></script>
<script src="/js/jquery_plugin_1.js"></script>
<script src="/js/jquery_plugin_2.js"></script>
<script src="/js/jquery_plugin_3.js"></script>
<script src="/js/my_scripts_1.js"></script>
<script src="/js/my_scripts_2.js"></script>
<script src="/js/my_scripts_3.js"></script>
<script src="/js/my_scripts_4.js"></script>
<!-- ...and so on -->
</head>

Since visitor count grows bigger, I am starting to think about performance of all of this. I have read, that it is good idea, to minify all javascript files and gather them together in one, so a browser must make only one HTTP request. I did so. Now I have everything.js file containing all javascript, including jquery, plugins and my custom scripts.

<head>
<!--
<script src="/js/jquery.js"></script>
<script src="/js/jquery_plugin_1.js"></script>
<script src="/js/jquery_plugin_2.js"></script>
<script src="/js/jquery_plugin_3.js"></script>
<script src="/js/my_scripts_1.js"></script>
<script src="/js/my_scripts_2.js"></script>
<script src="/js/my_scripts_3.js"></script>
<script src="/js/my_scripts_4.js"></script>
...
-->
<script src="/js/everything.js"></script>
</head>

The fun starts, when I need to make changes to one of the files. Every time, to check if my changes are working as expected, I need to compress the file and update everything.js or uncomment all the old code. With this kind of work-flow it is too easy to forget something and make a mistake.

Question: is there an automated thing that can take this headache away? Something, that would allow me to edit my separate files as I used to, and would minify and pull together everything when I’m ready to test my changes?

I’m using PHP5 and SVN

SOLUTION

Thank you for your help, everybody, I found my solution:
I will put a post-commit hook in my SVN repo that will take all my .js files, put them together and minify them using YUI compressor. Then, in my script I will fork javascript includes, so that in development environment the site will include separate javascript files, but in production the combined and minified file will be included.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:01:51+00:00Added an answer on May 18, 2026 at 12:01 pm

    We have custom deploy script taking care of it. In short, it minifies all CSS and JavaScript files using YUI Compressor and packs them in up to two files, one general and another one with specific logic for a given page. Once done, we create a symlink (or a new folder, depending on the project) to the folder with packed files and new changes are propagated instantly. This approach is used will all environments except development.

    Before minification, this is what CSS structure looks like (it’s more or less the same for JavaScript, it’s just to give you an idea):

    css/Layout/Core/reset.css
    css/Layout/Core/index.css
    css/Layout/Tools/notice.css
    css/Layout/Tools/form.css
    css/Layout/Tools/overlay.css
    css/Skin/Default/Core/index.css
    css/Skin/Default/Tools/notice.css
    css/Skin/Default/Tools/form.css
    css/Skin/Default/Tools/overlay.css
    css/Layout/Tools/gallery.css
    css/Layout/Tools/comments.css
    css/Layout/Tools/pagination.css
    css/Layout/Index/index.css
    css/Skin/Default/Tools/gallery.css
    css/Skin/Default/Tools/comments.css
    css/Skin/Default/Tools/pagination.css
    css/Skin/Default/Tools/achievements.css
    css/Skin/Default/Tools/labels_main.css
    css/Skin/Default/Index/index.css
    

    After:

    minified/1290589645/css/common.css
    minified/1290589645/css/0135f148a7f6188573d2957418119a9a.css
    

    We like this approach since it doesn’t involve any additional code to be processed on the fly. It’s just a matter of deployment which happens once every two weeks to production. Our staging environment is updated every day, sometimes even more than once a day, and we have not had any problems yet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a website that uses a lot of jQuery and I have
We have developed a website that uses MVC, C#, and jQuery. In one of
I have a client website and he uses a lot of css files and
I have experienced a weird problem with javascript. The problem page uses some jQuery
I have a website that uses AJAX heavily to communicate with the server. Now
We have a website that uses javascript, prototype for client scripting, We are starting
I have a website which uses a lot of constants, that are defined like
I have a website that uses the jQuery Address plugin from Asual for navigation.
We have a website that uses #include file command to roll info into some
I have a website that uses JSP as its view technology (and Spring MVC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.