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 7867041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:36:03+00:00 2026-06-03T00:36:03+00:00

I know questions around javascript compression have been asked multiple times but I cannot

  • 0

I know questions around javascript compression have been asked multiple times but I cannot find any answering my problem.

I have a project that has common scripts (jQuery and a few others) and page specific ones. jQuery Mobile allows you to cache common scripts during a session by downloading anything that is in <head> only once. The specific scripts are pulled only if the page is loaded as long as you put the <script> in the <div data-role="page">.

I find this great because it optimizes scripts that are downloaded while browsing the pages of my app and ensures the browser has the minimum javascript in memory at any time.

However, it is terrible for minification because there are dependencies between various files that cannot be merged.

So far I found two solutions that do not suit me so well:

  • using a simple minification script that does not change function and variable names: it doubles the size of the files compared to an advanced version
  • grouping all the scripts into one and compress it then put it in the <head>: you lose the ability to only download the scripts you may want and the browser has unnecessary functions loaded

(I exclude manually changing the function names obviously 😉 )

I am looking for a compressor that could do one of those:

  • compress all the files together but output them into seperate files to keep the modularity
  • if not possible, compress files independently in an advanced way but with tags that could prevent the minifier from renaming links to external functions or variables (such as jQuery ones)

Does it exist?

  • 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-06-03T00:36:04+00:00Added an answer on June 3, 2026 at 12:36 am

    After getting more familiar with all this, Google Closure Compiler can do that (and much more).

    The way to go is to define externs for:

    • the third party library you are using (jQuery, jQuery Mobile…). You can find some of them there.
    • the home made scripts that you load seperately

    Obviously, if you compress the home made scripts that are loaded separately, you should export the variables you want to use elsewhere using the following technique (detailed in Closure Compiler documentation) :

    /**
     * A function you want to be able to call from elsewhere after compressing
     * @param {string} a
     */
    function exportedFunction(a) {alert(a);}
    
    window['exportedFunction'] = exportedFunction;
    

    Then you can compress files you want in batches or separately. It is such a powerful tool that I cannot believe I did not use it before.

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

Sidebar

Related Questions

I know similar questions have been asked many times. But all I can find
I know this questions are already asked.But i couldn't find any proper answer for
I know similar questions have been asked, but I'm not sure about the answers
I know this question has been asked but I haven't found any satisfactory answers.
I have some basic questions around understanding fundamentals of Performance testing. I know that
I know the questions seems ambiguous, but I couldn't think of any other way
I have looked around for similar questions and I couldn't find an answer... I'd
I've been looking around for a similar question, but I couldn't find one. I'm
I have been playing around with some CSS3 + JavaScript today. Below you have
I know there are quite a few of those kind of questions around here,

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.