Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

petclinic.css does not exist #653

Closed
guochengjun1993 opened this issue Jul 25, 2020 · 8 comments
Closed

petclinic.css does not exist #653

guochengjun1993 opened this issue Jul 25, 2020 · 8 comments

Comments

@guochengjun1993
Copy link

guochengjun1993 commented Jul 25, 2020

Hi there, the styling of the site displaying incorrectly, Chrome debug console shows that request for petclinic.css was failed with an error code of 404, and i looked through both my local and online repository, and I couldn't find the file in path "/resources/css/petclinic.css". Could you guys provide the css file please? Thanks.
The Chrome debug console screenshot:
a8be52db4fa6abc623f429c3235121e

@ebiggerr
Copy link

ebiggerr commented Jul 26, 2020

The petclinic.css should be generated from the less file which located at "spring-petclinic\src\main\less*". Mine here, the styling is working.

@micheljr
Copy link

What you can also do is create a css directory in the static.resources directory and paste the less files in there.
This worked for me!

@guochengjun1993
Copy link
Author

The petclinic.css should be generated from the less file which located at "webapp\resources\less\petclinic.less". Mine here, the styling is working.

Thank you for the reply, when I try to compile the less files in vs code, there was this error came up ".label-success is undefined in file ...spring-petclinic-main\src\main\less\petclinic.less line no. 181", and I've searched the whole project, there is no other definition for ".label-success", is the less file complete?

@guochengjun1993
Copy link
Author

What you can also do is create a css directory in the static.resources directory and paste the less files in there.
This worked for me!

I tried this method, it didn't work for me, the error code is 404, my IDE is vs code, could it be vs code issue?

@vkbvipul
Copy link

I am also facing same issue.
Please assist.
Have tried options suggested but still no luck.

@ebiggerr
Copy link

I am also facing same issue.
Please assist.
Have tried options suggested but still no luck.

Hi there, the styling of the site displaying incorrectly, Chrome debug console shows that request for petclinic.css was failed with an error code of 404, and i looked through both my local and online repository, and I couldn't find the file in path "/resources/css/petclinic.css". Could you guys provide the css file please? Thanks.

CSS files are generated from the Maven build, using the less file in spring-petclinic\src\main\less*.less
There are two ways to generate the resources needed for the styling.

-Using local maven executable binary
If you have already installed maven in your computer, you can just cd to the project directory using the terminal available in your IDE or using cmd/Terminal depending on (Windows/Mac/Linux)
Example : cd C:\Users\xxx\projects\spring-petclinic
C:\Users\xxx\projects\spring-petclinic>mvn generate-resources

-using the maven wrapper
run the mvnw available in the project directory. using command ./mvnw generate-resources .

After the build success, you can run the spring petclinic application and access it from localhost:8080 and the styling will be working

@vkbvipul
Copy link

css gets generated using wro4j.
If you have installed mvn command line tool then go to project directory and execute command "mvn wro4j:run". Can refer https://stackoverflow.com/questions/3448648/how-do-i-run-a-specific-goal-with-a-particular-configuration-in-a-maven-plugin-w
If you are using eclipse right click on project -> Run As -> click Maven Build...
On "Goals" input field enter wro4j:run
Click Apply then Run.

My issue for css was resolved using same steps.

@snicoll
Copy link
Member

snicoll commented Nov 6, 2020

As others have indicated, the CSS is generated as part of the build. If you'r running petclinic from an IDE, the readme provides some more explanations.

@snicoll snicoll closed this as completed Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants