You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I Try to load style from my resources folder (/resources/static/css/styles.css) but get 404.
@Configuration
@EnableWebMvc
public class PugTemplateConfiguration {
@Bean
public SpringTemplateLoader templateLoader() {
SpringTemplateLoader templateLoader
= new SpringTemplateLoader();
templateLoader.setTemplateLoaderPath("classpath:/templates/");
templateLoader.setEncoding("UTF-8");
templateLoader.setSuffix(".pug");
return templateLoader;
}
@Bean
public PugConfiguration pugConfiguration() {
PugConfiguration configuration = new PugConfiguration();
configuration.setCaching(false);
configuration.setTemplateLoader(templateLoader());
return configuration;
}
@Bean
public ViewResolver viewResolver() {
PugViewResolver viewResolver = new PugViewResolver();
viewResolver.setConfiguration(pugConfiguration());
return viewResolver;
}
}
templates/index.pug
doctype html
html
head
meta(charset="UTF-8")
link(rel="stylesheet" type="text/css" href="css/style.css")
title document title
body
p hello, world!
styles located in resources/static/css/styles.css, in target folder I can see it in /static/css/styles.css
spring log:
DEBUG org.springframework.web.servlet.DispatcherServlet : GET "/css/style.css", parameters={}
WARN org.springframework.web.servlet.PageNotFound : No mapping for GET /css/style.css
DEBUG org.springframework.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
I tried to move style.css to 'templates' folder, but it did not help
The text was updated successfully, but these errors were encountered:
I Try to load style from my resources folder (/resources/static/css/styles.css) but get 404.
templates/index.pug
styles located in resources/static/css/styles.css, in target folder I can see it in /static/css/styles.css
spring log:
I tried to move style.css to 'templates' folder, but it did not help
The text was updated successfully, but these errors were encountered: