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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:21:58+00:00 2026-06-12T08:21:58+00:00

I’m writing a backbone.js app. I have multiple js, css and html template files.

  • 0

I’m writing a backbone.js app. I have multiple js, css and html template files. I also have a script to crunch them into a single file so it is faster to download. How should I work during development:

  1. Add a listener to the file system and after every change compile the files so I can see it in a browser. This implies a 1-2 seconds overhead before I can see what I did, which is annoying for html fine-tuning.

  2. Somehow browse using the multiple files during development and only crunch before going to production. This means I need to have a separate index.html for dev and prod.

What’s your take?

  • 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-12T08:21:59+00:00Added an answer on June 12, 2026 at 8:21 am

    I use Minify to combine and minify my JS, and in my index.html for my backbone apps, I simply have a code block like this:

       if (APP._dev === true) {
            // So on development, we load all the files individually
            $.when(
                    // Utilities
                    $.getScript(APP._rootDir + 'app/js/util.js'),
    
                    // Models
                    $.getScript(APP._rootDir + 'app/js/models/Timer.js'),
                    $.getScript(APP._rootDir + 'app/js/models/Section.js'),
    
                    // Collections
                    $.getScript(APP._rootDir + 'app/js/collections/Timers.js'),
                    $.getScript(APP._rootDir + 'app/js/collections/Sections.js'),
    
                    // Views
                    $.getScript(APP._rootDir + 'app/js/views/TitleView.js'),
                    $.getScript(APP._rootDir + 'app/js/views/BackgroundAudioView.js'),
    
                    // Router
                    $.getScript(APP._rootDir + 'app/js/routers/APPRouter.js'),
    
                    // Load in our templates file and add each template to a
                    // proerty visible in our application scope
                    $.get(APP._rootDir + 'app/js/templates/all.html',function(result){
                        var tmp = $('<div></div>').html(result);
                        $('script.template', tmp).each(function(){
                            APP._templates[this.id] = $(this).html();
                        });
                    },'html'),
    
                    // Here we create a new deferred object which we will bind
                    // to JQuery's ready() event.
                    $.Deferred(function (deferred) {
    
                        // DOM Ready. Invokes our APP.init() function.
                        $(deferred.resolve); // init
                    })
            ).done(
                    APP.init
            ).fail(
                    function () { /* fail how you would like */ }
            );
        } else {
            $.when(
                    // And on prod, we load a combined & minified JS file instead
                    $.getScript(APP._rootDir + 'min/?g=js'),
    
                    // Load in our templates file and add each template to a
                    // proerty visible in our application scope
                    $.get(APP._rootDir + 'app/js/templates/all.html',function(result){
                        var tmp = $('<div></div>').html(result);
                        $('script.template', tmp).each(function(){
                            APP._templates[this.id] = $(this).html();
                        });
                    },'html'),
    
                    // Here we create a new deferred object which we will bind
                    // to JQuery's ready() event.
                    $.Deferred(function (deferred) {
    
                        // DOM Ready. Invokes our APP.init() function.
                        $(deferred.resolve); // init
                    })
            ).done(
                    APP.init
            ).fail(
                    function () { /* fail how you would like */ }
            );
        }
    

    Then, in my groupsConfig in my Minify’s /min/ directory, I define my build array to match jQuery’s deferred object load order:

    return array(
        'js' => array(
            '//' . $rootDir . '/util.js',
    
            '//' . $rootDir . '/models/Timer.js',
            '//' . $rootDir . '/models/Section.js',
    
            '//' . $rootDir . '/collections/Timers.js',
            '//' . $rootDir . '/collections/Sections.js',
    
            '//' . $rootDir . '/views/TitleView.js',
            '//' . $rootDir . '/views/BackgroundAudioView.js',
    
            '//' . $rootDir . '/routers/APPRouter.js'
        ),
        'css' => array(),
    );
    

    It’s probably not as DRY as it could be but it works and you can tweak it for your needs.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have an autohotkey script which looks up a word in a bilingual dictionary
I am writing an app with both english and french support. The app requests
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.