最近,重构公司项目,在处理CSS这块时,其中有的class
的background
会跟随node_env
改变而改变,例如:
#baidu-abtest .title .image {
width: 90px;
height: 110px;
background: url(/* @echo OSS_URL *//saas_web/image/kefu.png) no-repeat center/cover;
margin-top: -74px;
margin-left: -4px;
float: left
}
之前处理,是通过gulp
插件preprocess
来实现。现在再nuxt中,配置nuxt.config.js
中的build
选项,但是没有起作用,代码如下:
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {
config.module.rules.push({
test: /\.vue$/,
use: [
{
loader: 'preprocess-loader',
options: {
context:{
FOO:'wangkaikaia'
}
}
}
]
})
},
有没有哪位大神配置过此类问题,麻烦帮忙看看,谢谢了