Skip to content

Commit

Permalink
feat(cli): 增加 weapp.compile.compressTemplate 来决定打包是否需要压缩 wxml
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jan 21, 2019
1 parent 25c9871 commit cfb4909
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/taro-cli/src/weapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,8 @@ async function buildSinglePage (page) {
env: constantsReplaceList
})
const pageDepComponents = transformResult.components
const pageWXMLContent = isProduction ? transformResult.compressedTemplate : transformResult.template
const compressTemplate = useCompileConf.compressTemplate
const pageWXMLContent = (isProduction && compressTemplate) ? transformResult.compressedTemplate : transformResult.template
const res = parseAst(PARSE_AST_TYPE.PAGE, transformResult.ast, pageDepComponents, pageJs, outputPageJSPath)
let resCode = res.code
resCode = await compileScriptFile(resCode, pageJs, outputPageJSPath, buildAdapter)
Expand Down Expand Up @@ -1754,7 +1755,8 @@ async function buildSingleComponent (componentObj, buildConfig = {}) {
adapter: buildAdapter,
env: constantsReplaceList
})
const componentWXMLContent = isProduction ? transformResult.compressedTemplate : transformResult.template
const compressTemplate = useCompileConf.compressTemplate
const componentWXMLContent = (isProduction && compressTemplate) ? transformResult.compressedTemplate : transformResult.template
const componentDepComponents = transformResult.components
const res = parseAst(PARSE_AST_TYPE.COMPONENT, transformResult.ast, componentDepComponents, component, outputComponentJSPath, buildConfig.npmSkip)
let resCode = res.code
Expand Down

0 comments on commit cfb4909

Please sign in to comment.