問題描述
我正在使用 Gulp 連接來自不同目錄的多個 css 文件(Bower 管理的依賴項).Font-awesome 是這些依賴項之一,它包含對其字體 url(../font....)
的相對引用.當 css 文件被連接并放置在不同的目錄中時,這個相對 url 顯然是錯誤的.是否有處理此問題的最佳實踐?
I'm using Gulp to concatenate several css files from different directories (Bower managed dependencies). Font-awesome is one of these dependencies and it contains a relative reference to its fonts url(../font....)
. When the css file is concatenated and placed in a different directory this relative url will obviously be wrong. Is there a best practice for dealing with this?
推薦答案
另一個選項是 gulp-css-rebase-urls,它是為解決這個問題而構建的.
Another option is gulp-css-rebase-urls which was built to address this problem.
https://www.npmjs.com/package/gulp-css-變基網址
這篇關于Gulp.js - 在連接時重寫嵌入在 css 中的 url的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!