Set Base URL to background image path in External CSS |
Any one can help me to add base url to my background image path in my external css. My code like below.
PHP Code: aside.main-sidebar{
And why do you need to do it? I got everything setup with absolute paths (like above) and some script use relative paths instead, like Jquery UI.
Assuming you are developing on one machine, and deploying to somewhere else, so the domain names will be different on all the instances, best solution usually means using relative paths.
You know where the CSS is, so you can go from there, replace it with ../../ui/assets/img for example. Remember not to start with / as this will point to your base domain. If you absolutely must do absolute paths in CSS file, you could set up a controller that outputs CSS file format text, however 99% of the time that's just over-complicating something that can be done with very straight forward solution. (06-22-2018, 01:24 AM)Pertti Wrote: Assuming you are developing on one machine, and deploying to somewhere else, so the domain names will be different on all the instances, best solution usually means using relative paths. (06-22-2018, 04:24 AM)Pertti Wrote:(06-22-2018, 04:20 AM)sanjaya Wrote: I have add it like below. But it not work It's in http://localhost/projects/charity/assets.../admin.css
Ok so you want to go from:
/projects/charity/assets/dist/css/admin.css to: /ui/assets/img/bg4.jpg So you have to go up 5 directories, then back in, which would make final URL: ../../../../../ui/assets/img/bg4.jpg (06-25-2018, 12:31 AM)Pertti Wrote:(06-25-2018, 12:11 AM)sanjaya Wrote: It's not work... This is directory: http://sghapps.tk/ui/assets/img/bg4.jpg |
Welcome Guest, Not a member yet? Register Sign In |