Opened 12 years ago

Closed 12 years ago

#3773 closed defect (fixed)

Build contains interned CSS twice for each widget

Reported by: Robert Coup Owned by: James Burke
Priority: high Milestone: 0.9
Component: BuildSystem Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

When doing a build with widgets, the resulting dojo.js/dojo.js.uncompressed.js end up with the widget css repeated twice... which is a bit of a waste of space.

Very simple testcase:

  • acme/widget/TestWidget.js
    dojo.provide("acme.widget.TestWidget");
    dojo.require("dijit._Widget");
    dojo.require("dijit._Templated");
    
    dojo.declare("acme.widget.TestWidget", [dijit._Widget, dijit._Templated], {
    	templateCssPath : dojo.moduleUrl("acme.widget", "templates/TestWidget.css")
    });
    
  • acme/widget/templates/TestWidget.css
    BODY {
        background-color: blue;
    }
    
  • test-build.profile.js
    dependencies = {
    	layers : [
    		{
    			name: "dojo.js",
    			dependencies: [ 
    				"acme.widget.TestWidget",
    			],
    		}
    	],
    
    	prefixes: [
    		[ "dijit", "../dijit" ]
    	]
    };
    
    load("getDependencyList.js");
    
  • Build command:
    java -jar lib/custom_rhino.jar build.js profileFile=/data/www/dojo/misc/test-build.profile.js action=clean,release
    

The output shows it interning TestWidget?.css twice (at two stages during the build), and sure enough, search for templateCssString and you see it twice in the output files.

I'm happy to look into this further if it doesn't immediately strike you what's going on.

Change History (5)

comment:1 Changed 12 years ago by bill

Surely this can't be a bug with 0.9, which doesn't even support templateCssPath.

comment:2 Changed 12 years ago by Robert Coup

Well, its still in there, and it works (nearly).

Maybe it should be taken out :)

comment:3 Changed 12 years ago by Robert Coup

util/buildscripts/jslib/buildUtil.js uses regexes to find templateCssPath then inserts the file contents in special handling code.

jburke, were you intending to use css-loading as part of builds at some point? Or should it just be cut out? I can prepare a patch for the latter.

comment:4 Changed 12 years ago by James Burke

Milestone: 0.9

Sorry for the late reply. We should just remove templateCssPath support in the intern strings stuff since dijit will not support it.

comment:5 Changed 12 years ago by James Burke

Resolution: fixed
Status: newclosed

(In [9973]) Fixes #3773. Even though templateCssPath is not supported by dijit any more, the larger problem in the build system was string interning running twice over layer files. Once for the layer file, then once as part of the _optimizeReleaseDirs step. Now, string interning as part of _optimizeReleaseDirs will ignore layer files. Leaving templateCssPath support in string interning for now.

Note: See TracTickets for help on using tickets.