0
私は現時点では本当に奇妙な問題を抱えています。Grunt - 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']);
};
私が実行した後、私はグランツを実行しますが、次のエラーが表示されます:
エラー:Unab "bustAFile.json"ファイルを解析します(予期しないトークン?)。
bustAFile.jsonの内容全体を新しいメモ帳ファイルにコピーすると、何も変更されません。できます。
Poweshellは私には見えない奇妙なエンコーディングを追加していますか?