DmytroNasyrov
CSS 'url' helper and Endpoint 'static_url'
Please help. Stucked in the middle of deploy. Umbrella project contains phoenix app, phoenix app contains static image assets which sits on S3 and CloudFront. I have added to endpoint:
static_url: [scheme: "https", host: "s3-us-west-2.amazonaws.com/tram-pam-pam/directory", port: 443]
It woks fine for html with static_url helper. Example: <link rel="stylesheet" href="<%= static_url(@conn, "/css/app.css") %>">
But it doesn’t work for CSS background-image: url("/images/phoenix.png");. Generated path is relative instead of the path from endpoint settings. How to generate absolute path to the image from CSS(surely using image with a digest)?
Thanks.
First Post!
OvermindDL1
Relative is absolutely what it should be. That is necessary if the system is put behind a proxy or so.
From css you should not be using an absolute path, you should be using a relative path. From CSS a url should always be relative to the current css file or should be an absolute path to another server.







