You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
604 B
17 lines
604 B
const path = require('path')
|
|
|
|
const isWin = /^win/.test(process.platform)
|
|
|
|
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
|
|
|
|
module.exports = function (content, map) {
|
|
this.cacheable && this.cacheable()
|
|
const resourcePath = normalizePath(this.resourcePath)
|
|
if (
|
|
resourcePath !== normalizePath(path.resolve(process.env.UNI_INPUT_DIR, 'App.vue')) &&
|
|
content.indexOf('platform="mp-weixin"') === -1 // 小程序组件暂不加scoped
|
|
) {
|
|
return this.callback(null, content.replace(/(<style\b[^><]*)>/ig, '$1 scoped>'), map)
|
|
}
|
|
this.callback(null, content, map)
|
|
}
|
|
|