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?
You can use gulp-replace. https://npmjs.org/package/gulp-replace
**gulp-replace can be called with a string or regex.**
*replace(string, replacement)*
string
Type: String
The string to search for replacement
Type: String
The replacement string.
*replace(regex, replace)*
Note: gulp-replace cannot perform regex replacement on streams.
regex
Type: RegExp
You could also use gulp-frep
Another option is gulp-css-rebase-urls which was built to address this problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.