Dynamic URLs in CSS/JS

后端 未结 9 1038
别跟我提以往
别跟我提以往 2021-02-05 16:14

I\'m splitting up one of my larger apps and introducing a \'cdn\' url to house common objects like CSS, javascript, and images to avoid duplication. What I need to do, though, i

9条回答
  •  花落未央
    2021-02-05 16:41

    You can also have a build process and use templates to generate environment specific files

    e.g. in a file called yoursite.template.css

    .cool-button { background-image: url('@@URL@@/images/button.png'); }

    create the yoursite.css file than replace @@URL@@ with the domain you want.

提交回复
热议问题