Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7430871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:12:30+00:00 2026-05-29T09:12:30+00:00

I have some CSS in a ClientBundle that uses a background url. Since I

  • 0

I have some CSS in a ClientBundle that uses a background url. Since I load the javascript (/MyModule/MyModule.nocache.js) from /index.html, my relative urls in CSS are from root. This means

.myBackground { background: url("images/background.png"); }

will try to load from /images/background.png. This seems like a perfect case for runtime css substitution. I added the following line to the top of my css file:

@eval moduleName com.google.gwt.core.client.GWT.getModuleName();

How do I now combine the moduleName variable with the string "images/background.png"?

I’m looking for something like:

@eval moduleName com.google.gwt.core.client.GWT.getModuleName();
.myBackground { background: url(moduleName + "images/background.png"); }

Unfortunately, this approach causes some errors in the output during compile:

Line 46 column 30: encountered " ". Was expecting one of: <NUMBER> <PERCENTAGE>
<PT> <MM> <CM> <PC> <IN> <PX> <EMS> <EXS> <DEG> <RAD> <GRAD> <MS> <SECOND> <HZ>
<KHZ> <DIMEN> <FUNCTION>

Note: I know, there’s CSS Sprites, and I’m using that in some places, but I can’t get those working correctly in this case because of GWT’s extra style information around a CSS sprite conflicting with the extra style stuff I need.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:12:31+00:00Added an answer on May 29, 2026 at 9:12 am

    You could always add a static function somewhere:

    public static String getBackgroundUrl(){
         return com.google.gwt.core.client.GWT.getModuleName() + "/images/background.png";
    }
    

    And in your CSS

    @eval BG_URL com.yourclass.getBackgroundUrl();
    
    .myBackground { background-url:BG_URL; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script that uses some css/javascript tabs, they work on my
I have some css code that shows a background color on hover. The text
I have some CSS and HTML that are as follows. There's a javascript code
I have some CSS that doesn't behave correctly with IE8. It works fine with
I have some CSS style that does not work in IE and that works
I have some questions about basic CSS that I was unable to understand or
Possible Duplicate: Avoiding repeated constants in CSS We have some theme colors that are
I have some CSS code that hides the cursor on a web page (it
I have some css files that are deployed in a feature scoped to site
I have some generated CSS and would like to use some css that could

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.