Changeset 12476
- Timestamp:
- 02/15/08 21:22:15 (11 months ago)
- Location:
- util/trunk/buildscripts
- Files:
-
- 3 modified
-
build.js (modified) (1 diff)
-
build_release.sh (modified) (1 diff)
-
jslib/buildUtil.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
util/trunk/buildscripts/build.js
r12302 r12476 319 319 320 320 if(kwArgs.cssOptimize){ 321 buildUtil.optimizeCss(releasePath, kwArgs.cssOptimize );321 buildUtil.optimizeCss(releasePath, kwArgs.cssOptimize, kwArgs.cssImportIgnore); 322 322 } 323 323 } -
util/trunk/buildscripts/build_release.sh
r12071 r12476 61 61 cd $buildName/util/buildscripts/ 62 62 chmod +x ./build.sh 63 ./build.sh profile=standard version=$1 releaseName=$buildName action=release63 ./build.sh profile=standard version=$1 releaseName=$buildName cssOptimize=comments.keepLines cssImportIgnore=../dijit.css action=release 64 64 cd ../../release/ 65 65 -
util/trunk/buildscripts/jslib/buildUtil.js
r12431 r12476 66 66 defaultValue: "", 67 67 helpText: "Specifies how to optimize CSS files. If \"comments\" is specified, " 68 + "then code comments and line returns are stripped. If \"comments.keepLines\" " 69 + "is specified, then code comments are stripped, but line returns are preserved." 70 }, 68 + "then code comments and line returns are stripped, and files referenced via @import " 69 + "are inlined. If \"comments.keepLines\" " 70 + "is specified, then code comments are stripped and @import calls are inlined, but line returns are preserved." 71 }, 72 73 "cssImportIgnore": { 74 defaultValue: "", 75 helpText: "If using cssOptimize=\"comments\", then you can force the @import inlining step " 76 + "to ignore a set of files by using this option. The value of this option should be a comma " 77 + "separated list of CSS files names to ignore. The file names should match whatever strings " 78 + "are used for the @import calls." 79 }, 80 71 81 "copyTests": { 72 82 defaultValue: true, … … 1115 1125 } 1116 1126 1117 buildUtil.optimizeCss = function(/*String*/startDir, /*String*/optimizeType ){1127 buildUtil.optimizeCss = function(/*String*/startDir, /*String*/optimizeType, /*String?*/cssImportIgnore){ 1118 1128 //summmary: Optimizes CSS files in a directory. 1119 1129 1120 1130 if(optimizeType.indexOf("comments") != -1){ 1131 //Make sure we have a delimited ignore list to make matching faster 1132 if(cssImportIgnore){ 1133 cssImportIgnore = cssImportIgnore + ","; 1134 } 1135 1121 1136 var fileList = fileUtil.getFilteredFileList(startDir, /\.css$/, true); 1122 1137 if(fileList){ … … 1127 1142 //Read in the file. Make sure we have a JS string. 1128 1143 var originalFileContents = fileUtil.readFile(fileName); 1129 var fileContents = buildUtil.flattenCss(fileName, originalFileContents );1144 var fileContents = buildUtil.flattenCss(fileName, originalFileContents, cssImportIgnore); 1130 1145 1131 1146 //Do comment removal. … … 1146 1161 fileContents = fileContents.replace(/\{\s/g, "{"); 1147 1162 fileContents = fileContents.replace(/\s\}/g, "}"); 1163 }else{ 1164 //Remove multiple empty lines. 1165 fileContents = fileContents.replace(/(\r\n)+/g, "\r\n"); 1166 fileContents = fileContents.replace(/(\n)+/g, "\n"); 1148 1167 } 1149 1168 }catch(e){ … … 1181 1200 } 1182 1201 1183 buildUtil.flattenCss = function(/*String*/fileName, /*String*/fileContents ){1202 buildUtil.flattenCss = function(/*String*/fileName, /*String*/fileContents, /*String?*/cssImportIgnore){ 1184 1203 //summary: inlines nested stylesheets that have @import calls in them. 1185 1204 … … 1199 1218 1200 1219 importFileName = buildUtil.cleanCssUrlQuotes(importFileName); 1220 1221 //Ignore the file import if it is part of an ignore list. 1222 if(cssImportIgnore && cssImportIgnore.indexOf(importFileName + ",") != -1){ 1223 return fullMatch; 1224 } 1225 1226 //Make sure we have a unix path for the rest of the operation. 1201 1227 importFileName = importFileName.replace(buildUtil.backSlashRegExp, "/"); 1202 1228