/
githubmirror
/
taro
Обзор
Документация
Войти
/
githubmirror
/
taro
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/postcss-plugin-constparse/index.js
27 строк
545 B
xueshuai7
feat: constparse esm导出问题修复
07 ноя 2022, 04:55
07 ноя 2022, 04:55
f927af0
Код
Авторство
О чём код?
const PLATFORM = { WEAPP: 'weapp', H5: 'h5' } module.exports = (opts = {}) => { opts = Object.assign({ constants: [{ key: 'taro-tabbar-height', val: '50PX' }] }, opts) return { postcssPlugin: 'postcss-plugin-constparse', Declaration (decl) { if (opts.platform === PLATFORM.WEAPP) return let value = decl.value opts.constants.forEach(item => { value = value.replace(new RegExp(item.key, 'g'), item.val) }) decl.value = value } } } module.exports.postcss = true