takacsot
takacsot

Reputation: 1767

jawr, webjars, bootstrap, spring mvc - glyphicons not displaying

I am using webjars for serving bootstrap css. And I am also using glyphicons from the webjar bundle.

BUT unfortunately icons are not loaded.

I have noticed that jawr is rewriting css urls:

url('../jar:/META-INF/resources/webjars/bootstrap/3.1.1/fonts/glyphicons-halflings-regular.ttf')

Unfortunately jawr is not serving ttf files.

Question:

Upvotes: 1

Views: 1235

Answers (1)

Romeo Jr Maranan
Romeo Jr Maranan

Reputation: 211

I'm having the same problem using WebJars with JAWR and Spring Boot. If you could just switch to Spring Boot, I have this temporary solution.

@Configuration
public class BaseWebConfigurer extends WebMvcConfigurerAdapter {
...

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        if (!registry.hasMappingForPattern("/fonts/**")) {
            registry.addResourceHandler("/fonts/**")
                    .addResourceLocations("classpath:/META-INF/resources/webjars/bootstrap/3.3.5/fonts/");
        }
    }
}

I have to explore on a more elegant solution. However, I don't have no more time. When I find out, I'll get back to you.

Upvotes: 0

Related Questions