Skip to content

Commit 10b32f9

Browse files
committed
Move template path code to the top
1 parent 9552a00 commit 10b32f9

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

lib/transform.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ const EVENT_HANDLER_METHODS = [
4949
function transform(componentPath) {
5050
let source = fs.readFileSync(componentPath, 'utf8');
5151

52+
let templatePath = guessTemplatePath(componentPath);
53+
if (!fs.existsSync(templatePath)) {
54+
throw new SilentError(`Could not find template at ${templatePath}`);
55+
}
56+
debug(`${componentPath}: templatePath: %o`, templatePath);
57+
58+
let template = fs.readFileSync(templatePath, 'utf8');
59+
5260
let root = j(source);
5361

5462
// find `export default Component.extend({ ... });` AST node
@@ -123,13 +131,6 @@ function transform(componentPath) {
123131
let classNameBindings = findClassNameBindings(properties);
124132
debug(`${componentPath}: classNameBindings: %o`, classNameBindings);
125133

126-
let templatePath = guessTemplatePath(componentPath);
127-
if (!fs.existsSync(templatePath)) {
128-
throw new SilentError(`Could not find template at ${templatePath}`);
129-
}
130-
debug(`${componentPath}: templatePath: %o`, templatePath);
131-
132-
let template = fs.readFileSync(templatePath, 'utf8');
133134
let templateAST = templateRecast.parse(template);
134135

135136
// set `tagName: ''`

0 commit comments

Comments
 (0)