From f7db62b0e6e66e9bce3cd33344119a498916c690 Mon Sep 17 00:00:00 2001 From: jp Date: Fri, 6 Apr 2018 02:35:10 +0100 Subject: [PATCH 1/7] :sparkles: added check for favicon in html head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #77 - ghost_head handles favicons so we should check that themes aren’t still including them in the html head --- lib/checks/001-deprecations.js | 7 ++++++- lib/spec.js | 8 +++++++- test/001-deprecations.test.js | 7 ++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/checks/001-deprecations.js b/lib/checks/001-deprecations.js index a5595cd1..def32d44 100644 --- a/lib/checks/001-deprecations.js +++ b/lib/checks/001-deprecations.js @@ -137,7 +137,12 @@ checkDeprecations = function checkDeprecations(theme, themePath) { className: '.page-template-slug', css: true, ruleCode: 'GS001-DEPR-CSS-PATS' - } + }, + { + helperRegEx: /{{\s*?asset "(favicon.+")}}/g, + helperName: '{{asset "favicon"}}', + ruleCode: 'GS001-DEPR-FAV' + }, ]; _.each(checks, function (check) { diff --git a/lib/spec.js b/lib/spec.js index 2c74c6bf..d061b22d 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -436,7 +436,13 @@ rules = { "details": "The {{ghost_foot}} helper should be present in your theme. It outputs scripts as saved in \"code injection\" scripts.
" + "The helper belongs just before the tag in your default.hbs template.
" + "For more details, please see the {{ghost_foot}} helper documentation." - } + }, + "GS001-DEPR-FAV": { + "level": "error", + "rule": "The usage of {{asset 'favicon'}} in HTML head is no longer required", + "details": "The usage of {{asset 'favicon'}} in the HTML head tag is no longer required because Ghost outputs this for you automatically in {{ghost_head}}.
" + + "To see, what else is rendered with the {{ghost_head}} helper, look here." + }, }; /** diff --git a/test/001-deprecations.test.js b/test/001-deprecations.test.js index 0dacec00..9db140f1 100644 --- a/test/001-deprecations.test.js +++ b/test/001-deprecations.test.js @@ -36,7 +36,8 @@ describe('001 Deprecations', function () { 'GS001-DEPR-TIMG', 'GS001-DEPR-CSS-AT', 'GS001-DEPR-CSS-PA', - 'GS001-DEPR-CSS-PATS' + 'GS001-DEPR-CSS-PATS', + 'GS001-DEPR-FAV' ); // pageUrl @@ -131,6 +132,10 @@ describe('001 Deprecations', function () { output.results.fail['GS001-DEPR-CSS-AT'].should.be.a.ValidFailObject(); output.results.fail['GS001-DEPR-CSS-AT'].failures.length.should.eql(1); + // favicon + output.results.fail['GS001-DEPR-FAV'].should.be.a.ValidFailObject(); + output.results.fail['GS001-DEPR-FAV'].failures.length.should.eql(1); + output.results.pass.should.be.an.Object().which.is.empty(); done(); From 6af6941d46f4b3c7e6d271345fc915b1d7017fc2 Mon Sep 17 00:00:00 2001 From: jp Date: Tue, 7 Aug 2018 13:24:04 +0100 Subject: [PATCH 2/7] :bug: fix merge conflict --- lib/spec.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/spec.js b/lib/spec.js index 5a499043..711f728d 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -75,7 +75,6 @@ templates = [ // @TODO: register rules in each checker! rules = { -<<<<<<< HEAD "GS001-DEPR-PURL": { "level": "error", "rule": "Replace {{pageUrl}} with {{page_url}}", @@ -444,7 +443,6 @@ rules = { "details": "The usage of {{asset 'favicon'}} in the HTML head tag is no longer required because Ghost outputs this for you automatically in {{ghost_head}}.
" + "To see, what else is rendered with the {{ghost_head}} helper, look here." }, -======= 'GS001-DEPR-PURL': { level: 'error', rule: 'Replace {{pageUrl}} with {{page_url}}', @@ -807,7 +805,6 @@ rules = { 'The helper belongs just before the tag in your default.hbs template.
' + 'For more details, please see the {{ghost_foot}} helper documentation.' } ->>>>>>> TryGhost/master }; /** From bce8b61b3bc3cec5b5fb20e1b6776dfa042e4f80 Mon Sep 17 00:00:00 2001 From: jp Date: Tue, 7 Aug 2018 21:10:23 +0100 Subject: [PATCH 3/7] Revert ":bug: fix merge conflict" This reverts commit 6af6941d46f4b3c7e6d271345fc915b1d7017fc2. --- lib/spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/spec.js b/lib/spec.js index 711f728d..5a499043 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -75,6 +75,7 @@ templates = [ // @TODO: register rules in each checker! rules = { +<<<<<<< HEAD "GS001-DEPR-PURL": { "level": "error", "rule": "Replace {{pageUrl}} with {{page_url}}", @@ -443,6 +444,7 @@ rules = { "details": "The usage of {{asset 'favicon'}} in the HTML head tag is no longer required because Ghost outputs this for you automatically in {{ghost_head}}.
" + "To see, what else is rendered with the {{ghost_head}} helper, look here." }, +======= 'GS001-DEPR-PURL': { level: 'error', rule: 'Replace {{pageUrl}} with {{page_url}}', @@ -805,6 +807,7 @@ rules = { 'The helper belongs just before the tag in your default.hbs template.
' + 'For more details, please see the {{ghost_foot}} helper documentation.' } +>>>>>>> TryGhost/master }; /** From f44f48cdde6bd2e8b40fa47ca91c4088c7c6c83d Mon Sep 17 00:00:00 2001 From: CriticalRespawn <37122500+CriticalRespawn@users.noreply.github.com> Date: Tue, 7 Aug 2018 21:17:59 +0100 Subject: [PATCH 4/7] Update spec.js --- lib/spec.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/spec.js b/lib/spec.js index 5a499043..711f728d 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -75,7 +75,6 @@ templates = [ // @TODO: register rules in each checker! rules = { -<<<<<<< HEAD "GS001-DEPR-PURL": { "level": "error", "rule": "Replace {{pageUrl}} with {{page_url}}", @@ -444,7 +443,6 @@ rules = { "details": "The usage of {{asset 'favicon'}} in the HTML head tag is no longer required because Ghost outputs this for you automatically in {{ghost_head}}.
" + "To see, what else is rendered with the {{ghost_head}} helper, look here." }, -======= 'GS001-DEPR-PURL': { level: 'error', rule: 'Replace {{pageUrl}} with {{page_url}}', @@ -807,7 +805,6 @@ rules = { 'The helper belongs just before the tag in your default.hbs template.
' + 'For more details, please see the {{ghost_foot}} helper documentation.' } ->>>>>>> TryGhost/master }; /** From 19086bd01d95f081fa18b250ef7fb2d6fb052f62 Mon Sep 17 00:00:00 2001 From: jp Date: Tue, 7 Aug 2018 21:22:52 +0100 Subject: [PATCH 5/7] :bug: fix conflict --- lib/spec.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/spec.js b/lib/spec.js index 711f728d..19f3bd31 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -804,7 +804,13 @@ rules = { details: 'The {{ghost_foot}} helper should be present in your theme. It outputs scripts as saved in "code injection" scripts.
' + 'The helper belongs just before the tag in your default.hbs template.
' + 'For more details, please see the {{ghost_foot}} helper documentation.' - } + }, + "GS001-DEPR-FAV": { + "level": "error", + "rule": "The usage of {{asset 'favicon'}} in HTML head is no longer required", + "details": "The usage of {{asset 'favicon'}} in the HTML head tag is no longer required because Ghost outputs this for you automatically in {{ghost_head}}.
" + + "To see, what else is rendered with the {{ghost_head}} helper, look here." + }, }; /** From 77663510fc6b4b2b7009950ab191c85dfeb6a0aa Mon Sep 17 00:00:00 2001 From: jp Date: Tue, 7 Aug 2018 21:32:53 +0100 Subject: [PATCH 6/7] :bug: fix spec.js --- lib/spec.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/spec.js b/lib/spec.js index 19f3bd31..711f728d 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -804,13 +804,7 @@ rules = { details: 'The {{ghost_foot}} helper should be present in your theme. It outputs scripts as saved in "code injection" scripts.
' + 'The helper belongs just before the tag in your default.hbs template.
' + 'For more details, please see the {{ghost_foot}} helper documentation.' - }, - "GS001-DEPR-FAV": { - "level": "error", - "rule": "The usage of {{asset 'favicon'}} in HTML head is no longer required", - "details": "The usage of {{asset 'favicon'}} in the HTML head tag is no longer required because Ghost outputs this for you automatically in {{ghost_head}}.
" + - "To see, what else is rendered with the {{ghost_head}} helper, look here." - }, + } }; /** From 6f5748cea3f7ced00997b6a4fd787785538f3e56 Mon Sep 17 00:00:00 2001 From: jp Date: Tue, 7 Aug 2018 21:38:33 +0100 Subject: [PATCH 7/7] :bug: fix spec.js --- lib/spec.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/spec.js b/lib/spec.js index 3f906228..9511c0f0 100644 --- a/lib/spec.js +++ b/lib/spec.js @@ -804,18 +804,14 @@ rules = { details: 'The {{ghost_foot}} helper should be present in your theme. It outputs scripts as saved in "code injection" scripts.
' + 'The helper belongs just before the tag in your default.hbs template.
' + 'For more details, please see the {{ghost_foot}} helper documentation.' -<<<<<<< HEAD - } -======= }, "GS001-DEPR-FAV": { "level": "error", - "rule": 'The usage of {{asset 'favicon'}} in HTML head is no longer required', - "details": 'The usage of {{asset 'favicon'}} in the HTML head tag is no longer required because Ghost outputs this for you automatically in {{ghost_head}}.
' + + "rule": 'The usage of {{asset "favicon"}} in HTML head is no longer required', + "details": 'The usage of {{asset "favicon"}} in the HTML head tag is no longer required because Ghost outputs this for you automatically in {{ghost_head}}.
' + 'To see, what else is rendered with the {{ghost_head}} helper, look here.' + 'For more details, please see the {{ghost_foot}} helper documentation.' }, ->>>>>>> origin/favicon-check }; /**