feat(postcss): add resolve

This commit is contained in:
fxy060608 2020-03-13 18:51:44 +08:00
parent 8dc7872a45
commit bd1622a823

View File

@ -1,7 +1,18 @@
module.exports = {
parser: require('postcss-comment'),
plugins: [
require('postcss-import'),
require('postcss-import')({
resolve (id, basedir, importOptions) {
if (id.startsWith('~@/')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
} else if (id.startsWith('@/')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
} else if (id.startsWith('/') && !id.startsWith('//')) {
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
}
return id
}
}),
require('autoprefixer')({
remove: process.env.UNI_PLATFORM !== 'h5'
}),