What to do if the background image is not applied after deployment
Background of writing this article
The background image is not displayed after deploying!
When I looked it up, there were quite a few people like that.
Implementation environment
macOS Catalina 10.15.7
VS Code 1.50.0
Ruby 2.6.5
Rails 6.0.0
Server: AWS EC2
WEB server: Nginx
Application server: unicorn 5.4.1
approach
I was able to do this.
After deployment, the background image will be displayed on the application etc. that went up to production.
① Store the background image in the "/ app / assets / images" folder
(2) Set the CSS type for specifying the background image to "SCSS".
③ CSS description to specify the background image "background-image: image-url (" image name ");"
scss
/*Example*/
body {
background-image: image-url("wallpaper.jpg ");
}
- On the contrary, with this description, the background image is not displayed in the local environment ... lol