Monday, February 28, 2011

CssResource and image sprites

Hi All,

I am facing a problem when i go for optimization using @sprite and cssResource.
The details as follows,

style.css 

body {
margin:0px;
font-family:Arial, Helvetica, sans-serif;
font-size:11px;
color:#333333;
}

a {
color:#333333;
text-decoration:none;
}

#header {
padding:5px 10px;
}

.clr {
clear:both;
}

#header-left {
float:left;
}

#header-right {
float:right;
padding-top:7px;
font-size:13px;
}

.left {
width:16%;
float:left;
}


.center {
width:42%;
float:left;
}

.right {
width:42%;
float:left;
}


.pop-up {
width:250px;
float:right;
}



@sprite .heading-left {
/* background:url(images/heading-left.jpg) left top no-repeat; */
gwt-image:'headingLeft'; 
height:32px;
padding-left:12px;
}

@sprite .heading-right {
/*background:url(images/heading-right.jpg) right top no-repeat;*/
gwt-image:'headingRight';
height:32px;
padding-right:12px;
}

@sprite .heading-middel {
/*background:url(images/heading-mid.jpg) top repeat-x;*/
gwt-image:'headingMid';
height:26px;
line-height:26px;
padding-top:6px;
padding-left:5px;
color:#FFFFFF;
}

.heading-middel-text {
float:left;
}

.heading-middel-icon {
float:right;
padding-top:11px;
padding-right:5px;
}

@sprite .middel-shadow-left {
/*background:url(images/mid-left.jpg) left repeat-y;*/
gwt-image:'midLeft';
padding-left:8px;
}

@sprite .middel-shadow-right {
/*background:url(images/mid-right.jpg) right repeat-y;*/
gwt-image:'midRight';
padding-right:8px;
min-height:500px;
}

@sprite .middel-shadow-right1 {
/*background:url(images/mid-right.jpg) right repeat-y;*/
gwt-image:'midRight';
padding-right:8px;
min-height:460px;
}


@sprite .middel-shadow-right2 {
/*background:url(images/mid-right.jpg) right repeat-y;*/
gwt-image:'midRight';
padding-right:8px;
}

@sprite .middel-shadow-right3 {
/*background:url(images/mid-right.jpg) right repeat-y;*/
gwt-image:'midRight';
padding-right:8px;
min-height:460px;
}

.box .middel-shadow-right {
min-height:inherit;
}


.middel-shadow-right3 ul,
.middel-shadow-right2 ul,
.middel-shadow-right ul {
margin:0px;
padding:10px;
}


@sprite .middel-shadow-right3 li,
@sprite .middel-shadow-right2 li,
@sprite .middel-shadow-right li {
gwt-image:'arrow';
margin:0px;
padding:0px 0 0 15px;
/*background:url(images/arrow.jpg) left no-repeat;*/
list-style:none;
}

@sprite .bottom-left {
/*background:url(images/bot-left.jpg) left top no-repeat;*/
gwt-image:'botLeft';
padding-left:12px;
height:12px;
}

@sprite .bottom-right {
/*background:url(images/bot-right.jpg) right top no-repeat;*/
gwt-image:'botRight';
padding-right:12px;
height:12px;
}

@sprite .bottom-middel {
/*background:url(images/bot-mid.jpg) top repeat-x;*/
gwt-image:'botMid';
height:12px;
}


@sprite .bottom-blue-left {
/*background:url(images/bot-b-left.jpg) left bottom no-repeat;*/
gwt-image:'botBLeft';
padding-left:12px;
}

@sprite .bottom-blue-right {
/*background:url(images/bot-b-right.jpg) right bottom no-repeat;*/
gwt-image:'botBRight';
padding-right:12px;
}

@sprite .bottom-blue-middel {
/*background:url(images/bot-b-mid.jpg) bottom repeat-x;*/
gwt-image:'botBMid';
padding:5px 4px 13px;
text-align:right;
}

.light-blue {
background:#c9e2fc;
padding:4px 10px;
}

.light-blue .inputdiv {
float:left;
width:25.3%;
margin-right:2px;
}

.light-blue .inputdiv1 {
float:left;
width:20%;
margin-right:2px;
}

.light-blue .inputdiv2 {
float:left;
width:12%;
margin-right:2px;
}

.light-blue .inputdiv3 {
float:left;
width:15%;
margin-right:2px;
padding-top:12px;
}

.light-blue select {
border:1px solid #5896db;
width:50px;
}

.light-blue input.inputbox {
width:93%;
border:1px solid #5896db;
padding:1px 2px;
}

form {
margin:0px;
padding:0px;
}

#footer {
background:url(images/footer.jpg) top repeat-x;
line-height:32px;
text-align:center;
color:#fff;
}

#footer a {
color:#FFFFFF;
text-decoration:none;
}

#footer1 {
text-align:center;
line-height:32px;
}

.font-label {
font-size: small;
font-style: normal;
font-weight: bold;
font-family: verdana, arial, helvetica, sans-serif;
float: inherit;
width: auto;
color: #4B4A4A;   /* previous color for black #4B4A4A */
padding-bottom: 3px;
padding-right: 15px;
padding-top: 3x;
text-align: center;
text-shadow: 1px 1px 0 #DDDDFF;
}


class MyResources extends ClientBundle {
  @Source("bundle/style.css")
CssResource style();
   
   @Source("bundle/shivDesign/heading-left.jpg")
ImageResource headingLeft();
@Source("bundle/shivDesign/heading-right.jpg")
ImageResource headingRight();

@Source("bundle/shivDesign/heading-mid.jpg")
ImageResource headingMid();

@Source("bundle/shivDesign/mid-left.jpg")
ImageResource midLeft();

@Source("bundle/shivDesign/mid-right.jpg")
ImageResource midRight();

@Source("bundle/shivDesign/arrow.jpg")
ImageResource arrow();

@Source("bundle/shivDesign/bot-left.jpg")
ImageResource botLeft();

@Source("bundle/shivDesign/bot-right.jpg")
ImageResource botRight();

@Source("bundle/shivDesign/bot-mid.jpg")
ImageResource botMid();

@Source("bundle/shivDesign/bot-b-left.jpg")
ImageResource botBLeft();

@Source("bundle/shivDesign/bot-b-right.jpg")
ImageResource botBRight();

@Source("bundle/shivDesign/bot-b-mid.jpg")
ImageResource botBMid();
}


In my onModuleLoad() {
   StyleInjector.inject(resource.style().getText());
}

Then i run in development mode and gets the following error

[DEBUG] [faregugly] - Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator
          [DEBUG] [faregugly] - Creating assignment for style()
                           [DEBUG] [faregugly] - Creating image sprite classes
                                                   22:43:18.998 [ERROR] [faregugly] The @sprite rule [] must specify the gwt-image property
                                                       22:43:18.960 [ERROR] [faregugly] Unable to process CSS
                                                         22:43:18.852 [ERROR] [faregugly] Deferred binding failed for 'com.faregugly.client.Resources'; expect subsequent failures
                                                       22:43:18.874 [ERROR] [faregugly] Failed to create an instance of 'com.faregugly.client.Faregugly' via deferred binding 


I make sure that all the @sprite has gwt-image property in css with proper imageResource method.
Do i need to do anything else for this sprite to work?

Thanks in advance

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment