Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can I set a css file to a custom viewlet?

Hi,

I'm developing a custom viewlet following this topic. It seems to work quite good, but I cannot load the css style.

I've a this organization:

- com.example.web (plugin-project)

- resources/ui/internal/ExampleViewlet.js

- resources/ui/internal/template/ExampleViewlet.html

- resources/ui/internal/template/ExampleViewlet.css

In the html I've put this tag:

 h1 class="com-example-web-ui-internal-ExampleViewlet">TEXT<

and in my css file I've

.com-example-web-ui-internal-ExampleViewlet .message{
color:#00ff00;
}

at last, in the js I've

templatePath: dojo.moduleUrl("com.example.web","ui/internal/templates/ExampleViewlet.html"),

Do I've missed something? How can I show the css to the widget?

Thanks,

Michele.

0 votes


Accepted answer

Permanent link
Hi Michele,

The CSS gets loaded automatically by our code loader once you associate it to the javascript module. This can be done using an extension point in your plugin.xml. It will look like this:

<extension point="net.jazz.ajax.cssBindingSets">
    <cssBindingSet id="com.example.web.CSSBindingSet" path="/ui/internal/templates">
        <cssBinding jsModule="com.example.web.ui.internal.ExampleViewlet">
            <cssModule path="/ExampleViewlet.css"/>
        </cssBinding>
    </cssBindingSet>
</extension>
Michele Pegoraro selected this answer as the correct answer

0 votes

Comments

Thanks, it works.

Best regards,

Michele.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927
× 152
× 84
× 9
× 1

Question asked: Nov 26 '12, 9:19 a.m.

Question was seen: 5,501 times

Last updated: Nov 30 '12, 5:13 a.m.

Confirmation Cancel Confirm