0

I have an issue to make two different builds on my app directory. I am using Backbone+CoffeeScript, so it's a lot of staff in the folders.

I used build.js to generate one big result.js and load it on the page.

Now i want to make two different router.coffee files to include router1.coffee in one build(excluding router2.coffee) and vise versa to the other build.

Project structure:

app/
   models/
         model.coffee 
   collections/
         collection.coffee
   .............
   lib/
   settings.coffee
   router1.coffee
   router2.coffee
   main.js
   build.js
build/
   result.js

My build.js:

({
    baseUrl: ".",
    name: "main",
    out: "../build/result.js",
    stubModules: ['cs', 'text'],
    exclude: ['coffee-script'],
    fileExclusionRegExp: /^views$/,
    preserveLicenseComments: false,
    optimize: "none",
    paths: {
      "cs"                 : "libs/cs",
      'coffee-script'      : 'libs/coffee-script',
      'jquery'             : 'libs/jquery-1.9.1',
      'jquery_ui'          : 'libs/jquery-ui.custom.min',
      'backbone'           : 'libs/backbone',
      'backbone-relational': 'libs/backbone-relational',

      //require.js dependency
      "requireLib"         : "libs/require"
    },
    shim: {
      'backbone': {
          deps: ['underscore', 'jquery'],
          exports: 'Backbone'
      },
      'underscore': {
          exports: '_'
      },
      'jquery_ui'         : ['jquery'],
      'fileDownload'      : ['jquery']
    },
    include: "requireLib"
})

How can i have result1.js with only router1 included, and result2.js with only router2 included?

4

1 回答 1

0

You should use two build.js file, one for each router.

于 2013-06-03T17:13:30.757 回答