Skip to content

Commit 78e7374

Browse files
committed
fix(generate): fix style and template url references
Dynamic paths for components were incorrectly generating paths for templates and styles Fixes #340
1 parent 41347b5 commit 78e7374

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

addon/ng2/blueprints/component/files/src/app/__path__/__name__/__name__.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {Component} from 'angular2/core';
33

44
@Component({
55
selector: '<%= dasherizedModuleName %>',
6-
templateUrl: 'app/<%= dynamicPath %>/<%= dasherizedModuleName %>/<%= dasherizedModuleName %>.html',
7-
styleUrls: ['app/<%= dynamicPath %>/<%= dasherizedModuleName %>/<%= dasherizedModuleName %>.css'],
6+
templateUrl: 'app<%= dynamicPath %>/<%= dasherizedModuleName %>/<%= dasherizedModuleName %>.html',
7+
styleUrls: ['app<%= dynamicPath %>/<%= dasherizedModuleName %>/<%= dasherizedModuleName %>.css'],
88
providers: [],
99
directives: [],
1010
pipes: []

addon/ng2/blueprints/component/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var stringUtils = require('ember-cli/lib/utilities/string');
22
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
3+
var path = require('path');
34

45
module.exports = {
56
description: '',

addon/ng2/utilities/dynamic-path-parser.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,9 @@ module.exports = function dynamicPathParser(project, entityName) {
2929

3030
var parsedPath = path.parse(adjustedPath);
3131

32+
parsedPath.dir = parsedPath.dir === path.sep
33+
? ''
34+
: parsedPath.dir;
35+
3236
return parsedPath;
3337
}

0 commit comments

Comments
 (0)