Skip to content

Commit

Permalink
Updated requirejs to latest snapshot which allows the removal of the …
Browse files Browse the repository at this point in the history
…config reading, placed the config back in index.js and fixed the JST window bug
  • Loading branch information
tbranyen committed Jan 23, 2012
1 parent fa8e044 commit dd698c8
Show file tree
Hide file tree
Showing 6 changed files with 316 additions and 127 deletions.
27 changes: 0 additions & 27 deletions app/config.js

This file was deleted.

30 changes: 29 additions & 1 deletion app/index.js
@@ -1,3 +1,31 @@
// Set the require.js configuration for your application.
require.config({
paths: {
// JavaScript folders
libs: "../assets/js/libs",
plugins: "../assets/js/plugins",

// Libraries
jquery: "../assets/js/libs/jquery",
underscore: "../assets/js/libs/underscore",
backbone: "../assets/js/libs/backbone",

// Shim Plugin
use: "../assets/js/plugins/use"
},

use: {
backbone: {
deps: ["use!underscore", "jquery"],
attach: "Backbone"
},

underscore: {
attach: "_"
}
}
});

define("namespace", [
"jquery",
"use!underscore",
Expand All @@ -13,7 +41,7 @@ function($) {
fetchTemplate: function(path, done) {
// Should be an instant synchronous way of getting the template, if it
// exists in the JST object.
var JST = this.JST = this.JST || {};
var JST = window.JST = window.JST || {};
if (JST[path]) {
return done(JST[path]);
}
Expand Down
28 changes: 1 addition & 27 deletions build/config.js
@@ -1,27 +1,3 @@
// This is the main Backbone Boilerplate build configuration file.

// Custom function to read in require.config settings
function readRequireConfig(path) {
var _require = require;
var obj;
var config = require("fs").readFileSync(path).toString();

// Patch over require since jshint complains about using with...
require = {
config: function(_obj) {
obj = _obj;
}
};

// Yes I know what this is doing...
eval(config);

// Restore require
require = _require;

return obj || {};
}

// This is a JavaScript file, you can define any functions you would like in
// here.
config.init({
Expand Down Expand Up @@ -79,9 +55,7 @@ config.init({
"assets/css": "dist/release"
}
}
},

requirejs: readRequireConfig("app/config.js")
}

});

Expand Down
3 changes: 3 additions & 0 deletions build/tasks/requirejs/index.js
Expand Up @@ -7,6 +7,9 @@ task.registerTask("requirejs", "require.js builder", function() {

// Merge passed options into defaults
options = underscore.extend({}, {
// Include the main configuration file
mainConfigFile: "app/index.js",

// Do not optimize
optimize: "none",

Expand Down

0 comments on commit dd698c8

Please sign in to comment.