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

  • Home
  • SEARCH
  • 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 9255775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:47:09+00:00 2026-06-18T11:47:09+00:00

I am beginning my first big javascript project! I had a question about deployment.

  • 0

I am beginning my first big javascript project! I had a question about deployment. I am using ajax calls to a webservice. To set this up I have a static JS file with code like:

var API_URL_ROOT = 'http://api.example.com/';

var IN_DEVELOPMENT = True;
if (IN_DEVELOPMENT) {
  API_URL_ROOT = 'http://localhost.com/api';
}

$.get(API_URL_ROOT)

I am using python/fabric to deploy. I was wondering if there were any prebuilt tools for handling the static analysis/manipulation of the javascript files., Right now it leaves toggling up to the commiters

I was planning on a deployment process like:

  1. issue deploy command
  2. “build” JS, by setting all values to production values (ie. IN_DEVELOPMENT = False)
  3. Minify JS
  4. Deploy code to production servers

I was thinking of just using sed or something to do the IN_DEVELPMENT = False replacement. I have looked at some of the popular minification tools and none seem to offer this sort of functionality.

I would assume that this is a pretty common problem for applications. How is it usually handled? Any help would be appreciated. Thank you

I recently read an article on hackernews from mozilla:

In the Mozilla Persona code base, we frequently expose difficult to
test private functions to the public interface, clearly marking the
extra functions as part of a test API. While other developers are
still able to call these private functions, the author’s intentions
are clear.

...
publicFunction: function() {
  return "publicFunction can be invoked externally but " 
             + privateFunction();
}

// BEGIN TESTING API
,
privateFunction: privateFunction
// END TESTING API
};

// privateFunction is now accessible via the TESTING API
function privateFunction() {
...

Code between the // BEGIN TESTING API and //END TESTING API
pseudo-markers can be removed for production during the build process.

So other companies are definitely doing this. Are there premade tools to facilitate the JS build proccess that can remove this code? I glanced at a number of their projects on github and didn’t see any. Thank you

  • 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-18T11:47:10+00:00Added an answer on June 18, 2026 at 11:47 am

    We are using dojo

    And in dojo you can use conditional exclusions for the build version of your js in order to exclude parts of your code that you would not want in your build js. Hope this helps.

    eg:

    var API_URL_ROOT = 'http://api.example.com/';
    
    //>>excludeStart("dev",!pragmas.dev);
        var IN_DEVELOPMENT = True;
    //>>excludeEnd("dev");
    
    if (IN_DEVELOPMENT) {
      API_URL_ROOT = 'http://localhost.com/api';
    }
    
    $.get(API_URL_ROOT)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this line to get the beginning time of the first day of
my first question sorry if this is too basic. I followed the tutorial Beginning
This is my little big question about containers, in particular, arrays. I am writing
Maybe it's a similar beginning, but it's true. first of all sorry if this
First off I am new to this site and it is a big help,
I am beginning to work on my first OpenGL iPhone app, but I've hit
I'm beginning to analyse datas for my thesis. I first need to count consecutive
I'm beginning a large scale javascript application with Marionette. A Marionette application has a
I was beginning to write a bubble sort for this when I thought maybe
I'm beginning a computer vision project and I need to compute the horizontal and

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.