Skip to content

Commit

Permalink
fix(cli): postcss-url 增加 basePath 配置,close #2334
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed May 8, 2019
1 parent 4ddbeca commit 37f6cf3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/taro-cli/src/mini/compileStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,14 @@ async function processStyleWithPostCSS (styleObj: IStyleObj): Promise<string> {
processors.push(pxtransform(postcssPxtransformConf))
}
if (cssUrlConf.enable) {
processors.push(cssUrlParse({
const cssUrlParseConf = {
url: 'inline',
maxSize,
encodeType: 'base64'
}))
}
processors.push(cssUrlParse(cssUrlConf.config.basePath ? Object.assign(cssUrlParseConf, {
basePath: cssUrlConf.config.basePath
}) : cssUrlParseConf))
}

const defaultPostCSSPluginNames = ['autoprefixer', 'pxtransform', 'url', 'cssModules']
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-cli/src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export namespace PostcssOption {
generateScopedName: string
}>
export type url = TogglableOptions<{
limit: number
limit: number,
basePath?: string | string[]
}>
}

Expand Down

0 comments on commit 37f6cf3

Please sign in to comment.