2013-08-24 2 views
2

저는 grunt-init을 사용하기 시작했습니다. 나는 템플릿에서 모든 이미지/* .png 파일이 대상 폴더로 이동 중에 손상된다는 것을 제외하고는 모든 작업을 수행했습니다.grunt-init copyAndProcess가 png 파일을 손상시킵니다.

init.copyAndProcess 함수가 템플릿 폴더에서 Gimp에서 열리지 만 대상 폴더에서는 열리지 않는다고 생각합니다.

내 템플릿의 파일 하위 집합에 대해 copyAndProcess 대신 복사본을 만들려면 어떻게해야합니까? 'images/**'와 같은 패턴을 사용하여 파일을 식별하는 것이 바람직합니다.

답변

0

음이 나는 template.js에 이미 것과 유사한보다 간결 뭔가 선호하는 것 :

var files = init.filesToCopy(props); 
init.copyAndProcess(files, props); 

을하지만이 작동합니다

var src_path = init.srcpath('images/'); 
var dest_path = init.destpath() + '/images/'; 

// Copy the images folder this way to prevent corrupting the files 
grunt.file.recurse(src_path, function(abspath, rootdir, subdir, filename) { 
    if (subdir == undefined) { 
     var dest = dest_path + filename; 
    } else { 
     var dest = dest_path + subdir + '/' + filename; 
    } 
    grunt.file.copy(abspath, dest); 
}); 
1

당신은 실제로 filesToCopy를 사용할 수 있기 때문에 처리하지 않아야하는 파일을 꿀꺽 꿀꺽 소리내는 (gunt-init)라고 말하는 noprocess 해시를 전달합니다.

http://gruntjs.com/project-scaffolding#copying-files (비정함 초기화 문서) 및이 커밋 https://github.com/gruntjs/grunt-init-jquery/blob/ecf070d7469d610441458111bc05cd543ee5bbc0/template.js의 73 행에있는 예를 참조하십시오.

+0

여기에 73의 내용이 있습니다 : init.copyAndProcess (files, props, {noProcess : 'libs/**'}); –

관련 문제