Skip to content

Commit

Permalink
feat(cli): CSS Modules 默认支持样式名中划线写法, close #1862
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jan 13, 2019
1 parent 3418dd6 commit 6cfa200
Show file tree
Hide file tree
Showing 2 changed files with 4,537 additions and 154 deletions.
10 changes: 7 additions & 3 deletions packages/taro-cli/src/weapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,11 @@ function parseAst (type, ast, depComponents, sourceFilePath, filePath, npmSkip =
const objectPropperties = []
for (const key in tokens) {
if (tokens.hasOwnProperty(key)) {
objectPropperties.push(t.objectProperty(t.identifier(key), t.stringLiteral(tokens[key])))
let keyPath = key
if (key.indexOf('-') >= 0) {
keyPath = `'${key}'`
}
objectPropperties.push(t.objectProperty(t.identifier(keyPath), t.stringLiteral(tokens[key])))
}
}
let defaultDeclator = null
Expand Down Expand Up @@ -1215,12 +1219,12 @@ function transfromNativeComponents (configFile, componentConfig) {
if (usingComponents && !Util.isEmptyObject(usingComponents)) {
Object.keys(usingComponents).map(async item => {
let componentPath = usingComponents[item]

if (Util.isAliasPath(componentPath, pathAlias)) {
componentPath = Util.replaceAliasPath(configFile, componentPath, pathAlias)
usingComponents[item] = componentPath
}

if (/^plugin:\/\//.test(componentPath)) {
// 小程序 plugin
Util.printLog(Util.pocessTypeEnum.REFERENCE, '插件引用', `使用了插件 ${chalk.bold(componentPath)}`)
Expand Down
Loading

0 comments on commit 6cfa200

Please sign in to comment.