는 다음과 같은 방법으로 구성 할 수 있습니다 플러그인 꿀꿀 텍스트를 교체하기 : 어쨌든
replace: {
myReplace: {
src: [ 'yourFile' ], //your file
dest: 'destinationFile', //path and namefile where you will save the changes.
replacements: [ {
from: /Titan\.include\('(.*)\.js'\);/g, //Regexp to match what you need
to: "myfunc('$1');" //Replacement for the Regexp
} ]
}
}
, 나는 꿀꿀 - 문자열 대체 플러그인을 사용하지,하지만 결코 대신 그것을 사용해야하는 경우 grunt-text-replace 나는 이런 식으로 일해야한다 :
'string-replace': {
dist: {
files: {
'dest/': 'yourfile' //Key: path where you will save the changes. Value: File or path where you will search.
},
options: {
replacements: [{
pattern: /Titan\.include\('(.*)\.js'\);/g,
replacement: "myfunc('$1');"
}]
}
}
좋아, 그럼 뭐 해봤 어? 오류가 있습니까? 우리는 문제가 무엇인지 알지 못합니다. – jakerella
@jakerella 나는 아래 것을 시도했다. 하지만 파일의 첫 번째 줄만 바꿀 수 있었고 다른 줄은 동일했습니다. DIST : { 파일 : [{ 확장 : 사실, CWD : '자원 /', SRC : '**/* JS.', 대상 : '자원 /' }], 옵션 : { 교체 : [{ 패턴 : 'Titan.include', 교체 '이 myfunc' }] } } – Bhavin2887