1
我正在用grunt使用coffeescript,並試圖僅包含JS文件文件模式「* .min.js」。不知何故,我的測試失敗,所有文件都包含在內。所以我的if語句總是返回true。我如何完成這項工作?Coffeescript if else does not work
getJsDependencies = ->
js_dependencies_path = path.join __dirname, "js", "dep"
paths = []
for js_file in fs.readdirSync(js_dependencies_path)
file_path = path.join __dirname, "js", "dep", js_file
console.log js_file
if js_file.indexOf ".min.js", 0 > 0
paths.push file_path
paths
我試過各種js_file.indexOf的組合,但我沒有與任何運氣只.min.js包含的文件。事實上,我想排除他們,但我堅持字符串匹配而不是邏輯。
幫助表示讚賞!
工作感謝你:) – timhysniu