Permalink
Browse files

Add an optional prefix for bundled js and css files.

Set it with `WebAppInternals.setBundledJsCssPrefix(prefix)`.
  • Loading branch information...
1 parent b5cd66d commit 6eccf8cbbb074bd750851a3f75595011aa7533ed Emily Stark committed Dec 6, 2013
Showing with 12 additions and 2 deletions.
  1. +10 −0 packages/webapp/webapp_server.js
  2. +2 −2 tools/bundler.js
@@ -18,6 +18,7 @@ var LONG_SOCKET_TIMEOUT = 120*1000;
WebApp = {};
WebAppInternals = {};
+var bundledJsCssPrefix;
var makeAppNamePathPrefix = function (appName) {
return encodeURIComponent(appName).replace(/\./g, '_');
@@ -528,6 +529,11 @@ var runWebAppServer = function () {
/##ROOT_URL_PATH_PREFIX##/g,
__meteor_runtime_config__.ROOT_URL_PATH_PREFIX || "");
+ boilerplateHtml = boilerplateHtml.replace(
+ /##BUNDLED_JS_CSS_PREFIX##/g,
+ bundledJsCssPrefix ||
+ __meteor_runtime_config__.ROOT_URL_PATH_PREFIX || "");
+
// only start listening after all the startup code has run.
var localPort = parseInt(process.env.PORT) || 0;
var host = process.env.BIND_IP;
@@ -707,3 +713,7 @@ WebAppInternals.inlineScriptsAllowed = function () {
WebAppInternals.setInlineScriptsAllowed = function (value) {
inlineScriptsAllowed = value;
};
+
+WebAppInternals.setBundledJsCssPrefix = function (prefix) {
+ bundledJsCssPrefix = prefix;
+};
View
@@ -782,13 +782,13 @@ _.extend(ClientTarget.prototype, {
'<html##HTML_ATTRIBUTES##>\n' +
'<head>\n');
_.each(self.css, function (css) {
- html.push(' <link rel="stylesheet" href="##ROOT_URL_PATH_PREFIX##');
+ html.push(' <link rel="stylesheet" href="##BUNDLED_JS_CSS_PREFIX##');
html.push(_.escape(css.url));
html.push('">\n');
});
html.push('\n\n##RUNTIME_CONFIG##\n\n');
_.each(self.js, function (js) {
- html.push(' <script type="text/javascript" src="##ROOT_URL_PATH_PREFIX##');
+ html.push(' <script type="text/javascript" src="##BUNDLED_JS_CSS_PREFIX##');
html.push(_.escape(js.url));
html.push('"></script>\n');
});

0 comments on commit 6eccf8c

Please sign in to comment.