0
나는이 순간 정말 이상한 문제가 있습니다.그란트 - Powershell 후 Json 파일을 읽을 수 없습니다. ConvertTo-Json
내 grunt-cache-breaker가 사용하는 파일 목록을 만들고 있습니다. 나는이 PowerShell 스크립트 사용하여 파일 목록 생성 :이 가진 파일을 생성
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
$file = @{}
#GET HTML FILES
$Dir = get-childitem $ScriptDir\Helix -recurse
$file = $Dir | where {$_.extension -eq ".html" } | % {$_.FullName}
#END
$file | convertto-jSon | out-file $ScriptDir\htmlfiles.json
포함이
[
"C:\\test\test1.html",
"C:\\test\test1.html",
"C:\\test\test1.html"
]
내 캐시 차단기 코드 같은입니다
module.exports = function(grunt) {
grunt.initConfig({
listOfHtmlPaths: grunt.file.readJSON('htmlfiles.json'),
cachebreaker: {
dev: {
options: {
match: ['.js', '.css', 'min.css'],
src:
{ path: 'Helix/**/*' }
},
files:
{ src: ['<%= listOfHtmlPaths %>'], }
},
},
});
grunt.loadNpmTasks('grunt-cache-breaker');
grunt.registerTask('default', ['cachebreaker']);
};
내가 실행 한 후 powershell 다음 나는 그란트를 실행하지만 다음과 같은 오류가 발생합니다 :
오류 : Unab "bustAFile.json"파일을 구문 분석합니다 (예기치 않은 토큰?).
bustAFile.json의 전체 내용을 새로운 메모장 파일로 복사해도 변경 사항이 전혀 없습니다. 그것은 작동합니다.
Poweshell은 내가 볼 수없는 이상한 인코딩을 추가합니까?