2013-04-10 1 views
1

에서 생성 된 파일을 포함하여이 내 index.html의 관련 부분 :그런트가 : usemin

<!-- build:js scripts/scripts.js --> 
<script src="scripts/vendor/jquery.js"></script> 
<script src="scripts/vendor/bootstrap.min.js"></script> 
<script src="scripts/vendor/handlebars.runtime.js"></script> 
<script src="scripts/vendor/ember.js"></script> 
<script src="scripts/vendor/ember-data.js"></script> 
<script src="scripts/templates.js"></script> 
<script src="scripts/neuterapp.js"></script> 
<!-- endbuild --> 

이것은 관련 (하지만 마지막 두 entrires이 잘못, 내 문제가 실제로) Gruntfile.js의 일부 :

useminPrepare: { 
     html: '<%= yeoman.app %>/index.html', 
     options: { 
      dest: '<%= yeoman.dist %>' 
     } 
    }, 
    usemin: { 
     html: ['<%= yeoman.dist %>/*.html'], 
     css: ['<%= yeoman.dist %>/styles/*.css'], 
     options: { 
      dirs: ['<%= yeoman.dist %>'] 
     } 
    }, 

내가 모두 templates.jsneuterapp.js 유전자 있다는 것입니다이 문제 정격 파일이므로 <%= yeoman.app %>/scripts이 아니라 <%= yeoman.dist %>/scripts에 있습니다.

이 내 (간체) 디렉토리 구조입니다 :

webapp/ 
├── app 
│   ├── app.js <--- for neuter 
│   ├── controllers 
│   ├── index.html 
│   ├── models 
│   ├── routes 
│   ├── scripts 
│   │   └── vendor <--- for usemin 
│   ├── templates <--- for ember_templates 
│   │   ├── template1.hbs 
│   │   └── template2.hbs 
│   └── views 
├── dist 
│   ├── index.html 
│   └── scripts 
│    ├── neuterapp.js <--- this must also be used for usemin!!! 
│    └── templates.js <--- this must also be used for usemin!!! 
└── Gruntfile.js 

가 어떻게 usemin을 말할 수있는 몇 가지 생성 된 파일을 포함하는?

neuter: { 
     options: { 
      includeSourceURL: true 
     }, 
     '<%= yeoman.dist %>/scripts/neuterapp.js': '<%= yeoman.app %>/app.js' 
    }, 
    ember_templates: { 
     compile: { 
      options: { 
       templateName: function (sourceFile) { 
        return sourceFile.replace(/app\/templates\//, ''); // <%= yeoman.dist %>/scripts/ 
       } 
      }, 
      files: { 
       '<%= yeoman.dist %>/scripts/templates.js': [ 
        '<%= yeoman.app %>/templates/**/*.hbs' 
       ] 
      } 
     } 
    }, 

답변

2

당신은 임시 위치에서 요구 usemin 무엇을 준비 할 copy task을 사용할 수 있습니다 :

그리고이 필요할 경우에 대비

, 이들은 neuterember_templates의 구성이다. 내가 당신을 제안 무엇

는 수행

  • usemin &하자 임시로 파일 출력을 생성하여 작업을하자 응용 프로그램
  • 온도 에에서 필요한 응용 프로그램 파일을 복사 useminPrepare 작업은 임시 직원에서 실행되고 으로 출력됩니다. dist.
+1

''는 스크립트 파일을 .tmp로 찾을 것입니다 '및'app'. – amiuhle

+0

JSBIN 예제를 제공 할 수 있다면. 그것은 큰 도움이 될 것입니다. –