Permalink
Browse files

trying a version of almond without plugin support. just saves about 1…

…00 bytes minified/gzipped.
  • Loading branch information...
1 parent 6597347 commit e707a6d5b5ff47692bd937c190cf6c912091f459 @jrburke jrburke committed Nov 23, 2011
Showing with 31 additions and 3 deletions.
  1. +14 −3 almond.js
  2. +10 −0 noplugin.build.js
  3. +7 −0 shrinktest-noplugin.sh
View
17 almond.js
@@ -82,6 +82,7 @@ var requirejs, require, define;
};
}
+ //>>excludeStart('excludeAlmondPlugins', pragmas.excludeAlmondPlugins)
function makeNormalize(relName) {
return function (name) {
return normalize(name, relName);
@@ -93,6 +94,7 @@ var requirejs, require, define;
defined[depName] = value;
};
}
+ //>>excludeEnd('excludeAlmondPlugins')
/**
* Makes a name map, normalizing the name, and using a plugin
@@ -103,6 +105,7 @@ var requirejs, require, define;
var prefix, plugin,
index = name.indexOf('!');
+ //>>excludeStart('excludeAlmondPlugins', pragmas.excludeAlmondPlugins)
if (index !== -1) {
prefix = normalize(name.slice(0, index), relName);
name = name.slice(index + 1);
@@ -115,14 +118,19 @@ var requirejs, require, define;
name = normalize(name, relName);
}
} else {
+ //>>excludeEnd('excludeAlmondPlugins')
name = normalize(name, relName);
+ //>>excludeStart('excludeAlmondPlugins', pragmas.excludeAlmondPlugins)
}
+ //>>excludeEnd('excludeAlmondPlugins')
//Using ridiculous property names for space reasons
return {
+ //>>excludeStart('excludeAlmondPlugins', pragmas.excludeAlmondPlugins)
+ p: plugin,
+ //>>excludeEnd('excludeAlmondPlugins')
f: prefix ? prefix + '!' + name : name, //fullName
- n: name,
- p: plugin
+ n: name
};
}
@@ -161,10 +169,13 @@ var requirejs, require, define;
};
} else if (depName in defined) {
args[i] = defined[depName];
- } else if (map.p) {
+ }
+ //>>excludeStart('excludeAlmondPlugins', pragmas.excludeAlmondPlugins)
+ else if (map.p) {
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
args[i] = defined[depName];
}
+ //>>excludeEnd('excludeAlmondPlugins')
}
}
View
10 noplugin.build.js
@@ -0,0 +1,10 @@
+({
+ baseUrl: '.',
+ name: 'almond',
+ out: 'almond-noplugin.js',
+ skipModuleInsertion: true,
+ optimize: 'none',
+ pragmas: {
+ excludeAlmondPlugins: true
+ }
+})
View
7 shrinktest-noplugin.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+rm almond-noplugin.min.js.gz
+node ../r.js/r.js -o noplugin.build.js
+~/scripts/closure.sh almond-noplugin.js almond-noplugin.min.js
+gzip almond-noplugin.min.js
+ls -la almond-noplugin.min.js.gz
+

0 comments on commit e707a6d

Please sign in to comment.