Skip to content

Commit

Permalink
fix(cli): fixed pad line for wxs
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcaufy committed Oct 8, 2018
1 parent 796b1f1 commit aeb8fc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 5 additions & 1 deletion packages/cli/core/plugins/build/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ exports = module.exports = function () {
wxs.forEach(item => {
wxsCode += item.parsed.output + '\n';
});
template.outputCode = wxsCode + template.outputCode;
template.outputCode =
'<!---------- wxs start ----------->\n' +
wxsCode +
'<!---------- wxs end ----------->\n' +
template.outputCode;
}
let targetFile = comp.npm ? this.getModuleTarget(comp.file) : this.getTarget(comp.file);
let target = path.parse(targetFile);
Expand Down
9 changes: 3 additions & 6 deletions packages/cli/core/plugins/parser/wxs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ exports = module.exports = function () {
this.register('wepy-parser-wxs', function (node, ctx) {

let moduleId = node.attrs.module;
let code = node.compiled.code;

let code = node.compiled.code.trim();
let output = '<wxs module="' + moduleId + '">\n' + code + '\n</wxs>';
return {
output: `<wxs module="${moduleId}">
${code}
</wxs>
`
output
};
});
};

0 comments on commit aeb8fc6

Please sign in to comment.