-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize RequireJS modules using Almond or AMD Clean.
- Loading branch information
Rishabh Rao
committed
May 30, 2015
1 parent
0a6f6e0
commit 7329a53
Showing
9 changed files
with
82 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ function($, HLJS, Drawer) { | |
}, | ||
|
||
init: function(options) { | ||
|
||
this.fetch(); | ||
this.attach(); | ||
this.setup(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require.config({ | ||
paths: { | ||
// Libraries | ||
"jquery": "../../libraries/jquery/jquery", | ||
"hljs": "../../libraries/highlightjs/highlight.pack", | ||
// /Libraries | ||
|
||
// Application | ||
"app": "app", | ||
// /Application | ||
}, | ||
|
||
shim: { | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var gulp = require("gulp"); | ||
var CFG = require("./utils/config.js"); | ||
var $ = require("gulp-load-plugins")(); | ||
var path = require("path"); | ||
var pkg = require(path.join("..", CFG.FILE.config.pkg)); | ||
var notify = require("./utils/notify-script-test-unit"); | ||
var rjs = require("requirejs"); | ||
|
||
/** | ||
* script:optimize | ||
* @see www.npmjs.org/package/requirejs | ||
*/ | ||
gulp.task("script:optimize", [/*"script:test"*/], function (callback) { | ||
console.log("__dirname", __dirname); | ||
rjs.optimize({ | ||
baseUrl: path.join(CFG.DIR.src, CFG.DIR.script), | ||
mainConfigFile: path.join(CFG.DIR.src, CFG.DIR.script, CFG.FILE.config.scriptMain), | ||
name: "../../libraries/almond/almond.js", | ||
optimize: "none", | ||
uglify2: { | ||
preserveComments: "some", | ||
compress: { | ||
drop_console: true, | ||
dead_code: true, | ||
drop_debugger: true, | ||
join_vars: true, | ||
warnings: false, | ||
pure_funcs: [/* "console.log" */] | ||
} | ||
}, | ||
optimizeCss: "none", | ||
findNestedDependencies: true, | ||
include: [ | ||
"app" | ||
], | ||
exclude: [ | ||
"hljs", | ||
"jquery" | ||
], | ||
out: path.join(CFG.DIR.dist, CFG.DIR.script, CFG.FILE.config.scriptMain), | ||
wrap: { | ||
startFile: "tasks/utils/umd-frag-prelude.js", | ||
endFile: "tasks/utils/umd-frag-coda.js" | ||
} | ||
}, function(buildResponse) { | ||
callback(); | ||
}, callback); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
return require("voxel"); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(function(root, factory) { | ||
if (typeof define === "function") { | ||
define(factory); | ||
} else if (typeof exports === "object") { | ||
module.exports = factory(); | ||
} else { | ||
root.voxel = factory(); | ||
} | ||
}(this, function() { |