Changeset 12476

Show
Ignore:
Timestamp:
02/15/08 21:22:15 (11 months ago)
Author:
jburke
Message:

Fixes #5855: introduces cssImportIgnore and sets up build_release.sh to do a safe css optimization that excludes dijit.css from inlining in each theme. \!strict

Location:
util/trunk/buildscripts
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • util/trunk/buildscripts/build.js

    r12302 r12476  
    319319         
    320320        if(kwArgs.cssOptimize){ 
    321                 buildUtil.optimizeCss(releasePath, kwArgs.cssOptimize); 
     321                buildUtil.optimizeCss(releasePath, kwArgs.cssOptimize, kwArgs.cssImportIgnore); 
    322322        } 
    323323} 
  • util/trunk/buildscripts/build_release.sh

    r12071 r12476  
    6161cd $buildName/util/buildscripts/ 
    6262chmod +x ./build.sh 
    63 ./build.sh profile=standard version=$1 releaseName=$buildName action=release 
     63./build.sh profile=standard version=$1 releaseName=$buildName cssOptimize=comments.keepLines cssImportIgnore=../dijit.css action=release 
    6464cd ../../release/ 
    6565 
  • util/trunk/buildscripts/jslib/buildUtil.js

    r12431 r12476  
    6666                defaultValue: "", 
    6767                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 
    7181        "copyTests": { 
    7282                defaultValue: true, 
     
    11151125} 
    11161126 
    1117 buildUtil.optimizeCss = function(/*String*/startDir, /*String*/optimizeType){ 
     1127buildUtil.optimizeCss = function(/*String*/startDir, /*String*/optimizeType, /*String?*/cssImportIgnore){ 
    11181128        //summmary: Optimizes CSS files in a directory. 
    11191129         
    11201130        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 
    11211136                var fileList = fileUtil.getFilteredFileList(startDir, /\.css$/, true); 
    11221137                if(fileList){ 
     
    11271142                                //Read in the file. Make sure we have a JS string. 
    11281143                                var originalFileContents = fileUtil.readFile(fileName); 
    1129                                 var fileContents = buildUtil.flattenCss(fileName, originalFileContents); 
     1144                                var fileContents = buildUtil.flattenCss(fileName, originalFileContents, cssImportIgnore); 
    11301145 
    11311146                                //Do comment removal. 
     
    11461161                                                fileContents = fileContents.replace(/\{\s/g, "{"); 
    11471162                                                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"); 
    11481167                                        } 
    11491168                                }catch(e){ 
     
    11811200} 
    11821201 
    1183 buildUtil.flattenCss = function(/*String*/fileName, /*String*/fileContents){ 
     1202buildUtil.flattenCss = function(/*String*/fileName, /*String*/fileContents, /*String?*/cssImportIgnore){ 
    11841203        //summary: inlines nested stylesheets that have @import calls in them. 
    11851204 
     
    11991218 
    12001219                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. 
    12011227                importFileName = importFileName.replace(buildUtil.backSlashRegExp, "/"); 
    12021228