1
1
/**
2
- * @license r.js 2.1.2+ Tue, 15 Jan 2013 01:33:33 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
2
+ * @license r.js 2.1.2+ Wed, 16 Jan 2013 01:24:27 GMT Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
3
3
* Available via the MIT or new BSD license.
4
4
* see: http://github.com/jrburke/requirejs for details
5
5
*/
@@ -21,7 +21,7 @@ var requirejs, require, define;
21
21
22
22
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
23
23
nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode,
24
- version = '2.1.2+ Tue, 15 Jan 2013 01:33:33 GMT',
24
+ version = '2.1.2+ Wed, 16 Jan 2013 01:24:27 GMT',
25
25
jsSuffixRegExp = /\.js$/,
26
26
commandOption = '',
27
27
useLibLoaded = {},
@@ -21201,9 +21201,10 @@ function (lang, logger, envOptimize, file, parse,
21201
21201
* @param {String} fileName the file name
21202
21202
* @param {String} fileContents the file contents
21203
21203
* @param {String} cssImportIgnore comma delimited string of files to ignore
21204
+ * @param {String} cssPrefix string to be prefixed before relative URLs
21204
21205
* @param {Object} included an object used to track the files already imported
21205
21206
*/
21206
- function flattenCss(fileName, fileContents, cssImportIgnore, included) {
21207
+ function flattenCss(fileName, fileContents, cssImportIgnore, cssPrefix, included) {
21207
21208
//Find the last slash in the name.
21208
21209
fileName = fileName.replace(lang.backSlashRegExp, "/");
21209
21210
var endIndex = fileName.lastIndexOf("/"),
@@ -21254,7 +21255,7 @@ function (lang, logger, envOptimize, file, parse,
21254
21255
included[fullImportFileName] = true;
21255
21256
21256
21257
//Make sure to flatten any nested imports.
21257
- flat = flattenCss(fullImportFileName, importContents, cssImportIgnore, included);
21258
+ flat = flattenCss(fullImportFileName, importContents, cssImportIgnore, cssPrefix, included);
21258
21259
importContents = flat.fileContents;
21259
21260
21260
21261
if (flat.importList.length) {
@@ -21283,8 +21284,9 @@ function (lang, logger, envOptimize, file, parse,
21283
21284
//a protocol.
21284
21285
colonIndex = fixedUrlMatch.indexOf(":");
21285
21286
if (fixedUrlMatch.charAt(0) !== "/" && (colonIndex === -1 || colonIndex > fixedUrlMatch.indexOf("/"))) {
21286
- //It is a relative URL, tack on the path prefix
21287
- urlMatch = importPath + fixedUrlMatch;
21287
+ //It is a relative URL, tack on the cssPrefix and path prefix
21288
+ urlMatch = cssPrefix + importPath + fixedUrlMatch;
21289
+
21288
21290
} else {
21289
21291
logger.trace(importFileName + "\n URL not a relative URL, skipping: " + urlMatch);
21290
21292
}
@@ -21414,7 +21416,7 @@ function (lang, logger, envOptimize, file, parse,
21414
21416
21415
21417
//Read in the file. Make sure we have a JS string.
21416
21418
var originalFileContents = file.readFile(fileName),
21417
- flat = flattenCss(fileName, originalFileContents, config.cssImportIgnore, {}),
21419
+ flat = flattenCss(fileName, originalFileContents, config.cssImportIgnore, config.cssPrefix, {}),
21418
21420
//Do not use the flattened CSS if there was one that was skipped.
21419
21421
fileContents = flat.skippedList.length ? originalFileContents : flat.fileContents,
21420
21422
startIndex, endIndex, buildText, comment;
@@ -23170,6 +23172,12 @@ define('build', function (require) {
23170
23172
if (!config.out) {
23171
23173
throw new Error('"out" option missing.');
23172
23174
}
23175
+ if (config.cssPrefix) {
23176
+ //Make sure cssPrefix ends in a slash
23177
+ config.cssPrefix = endsWithSlash(config.cssPrefix);
23178
+ } else {
23179
+ config.cssPrefix = '';
23180
+ }
23173
23181
}
23174
23182
if (!config.cssIn && !config.baseUrl) {
23175
23183
//Just use the current directory as the baseUrl
0 commit comments