From 30823fca0a75ae7790717b2f89ad3918816d6987 Mon Sep 17 00:00:00 2001 From: Joel Ma Date: Mon, 5 Dec 2016 19:16:03 +0800 Subject: [PATCH] fix css and js helper to prevent adding .css/.js when the path already has parameter (#2274) --- lib/plugins/helper/css.js | 2 +- lib/plugins/helper/js.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plugins/helper/css.js b/lib/plugins/helper/css.js index b8f58f7d71..b12db130aa 100644 --- a/lib/plugins/helper/css.js +++ b/lib/plugins/helper/css.js @@ -12,7 +12,7 @@ function cssHelper() { if (Array.isArray(path)) { result += cssHelper.apply(this, path); } else { - if (path.substring(path.length - 4, path.length) !== '.css') path += '.css'; + if (path.indexOf('?') < 0 && path.substring(path.length - 4, path.length) !== '.css') path += '.css'; result += ''; } } diff --git a/lib/plugins/helper/js.js b/lib/plugins/helper/js.js index bea2cab015..390a88ca28 100644 --- a/lib/plugins/helper/js.js +++ b/lib/plugins/helper/js.js @@ -12,7 +12,7 @@ function jsHelper() { if (Array.isArray(path)) { result += jsHelper.apply(this, path); } else { - if (path.substring(path.length - 3, path.length) !== '.js') path += '.js'; + if (path.indexOf('?') < 0 && path.substring(path.length - 3, path.length) !== '.js') path += '.js'; result += ''; } }