2014-04-13 2 views
0

저는 각양 각색 프로젝트를 위해 yeoman, bower, nmp 및 grunt를 사용하고 있습니다. 기본적으로 app 위치를 _attachments으로 대체하겠습니다. 내가 예를 들어 보좌관으로, 뷰 컨트롤러를 만드는거야 때 나는,Yeoman : 'app` 위치 무시하기

Gruntfile.js:  app: require('./bower.json').appPath || '_attachments' 

그러나 Gruntfile.js 안쪽이 변경을 완료했습니다 yo angular:controller xxx 여전히 내부에 app 디렉토리가 생성됩니다. 어떻게 무시할 수 있습니까?

답변

0

발전기 각도의 문서에있는 this에 따르면 bower.json에 다음과 같이 appPath 옵션을 추가 할 수 있습니다.

{ 
    ... 
    "appPath": "_attachments" 
} 

이 옵션은 발전기 각도의 script-base.js에서 아래의 코드를로드됩니다.

 this.env.options.appPath = require(path.join(process.cwd(), 'bower.json')).appPath; 

this.env.options.appPath 출력 디렉토리를 지정 Generator.prototype.appTemplate() 기능에 사용된다.

Generator.prototype.appTemplate = function (src, dest) { 
    yeoman.generators.Base.prototype.template.apply(this, [ 
    src + this.scriptSuffix, 
    path.join(this.env.options.appPath, dest.toLowerCase()) + this.scriptSuffix 
    ]); 
}; 

은 또한 나를 위해 appPathbower.json의 작품이 예상대로 확인했습니다.

+0

작동하지 않습니다. 여전히'app' 디렉토리에 쓰려고합니다. 나는 yeower가 bower에 관심이 있는지 의심 스럽다 .json – Archer

+0

나는 어제를 두 번 확인한 generator-angles의 소스 코드에서 더 많은 정보를 추가했다. – eqot

0

이것은 다소 오래된 질문이지만, 귀하가 찾고있는 것이 프로젝트 디렉토리의 .yo-rc.json에 있다고 생각합니다. 여기에서 yeoman이 여러 항목을 작성하는 디렉토리를 설정할 수 있습니다.