Gulp.js - 在连接时重写嵌入在 css 中的 url

2024-02-29

我正在使用 Gulp 连接来自不同目录的多个 css 文件(Bower 管理的依赖项)。 Font-awesome 是这些依赖项之一,它包含对其字体的相对引用url(../font....)。当 css 文件连接并放置在不同的目录中时,这个相对 url 显然是错误的。有处理这个问题的最佳实践吗?


您可以使用 gulp-replace。https://npmjs.org/package/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

您还可以使用 gulp-frep

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Gulp.js - 在连接时重写嵌入在 css 中的 url 的相关文章

随机推荐