0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Added ghost scope to CSS variable

refs 74fe765410

- Added scoping to the global CSS variable being set by Ghost to prevent theme conflicts and create a forwards compatible pattern
This commit is contained in:
Hannah Wolfe 2021-03-02 19:48:58 +00:00
parent 74fe765410
commit acd7e41e21
2 changed files with 3 additions and 3 deletions

View file

@ -175,7 +175,7 @@ module.exports = function ghost_head(options) { // eslint-disable-line camelcase
if (settingsCache.get('accent_color')) {
const accentColor = escapeExpression(settingsCache.get('accent_color'));
const styleTag = `<style>:root {--accent-color: ${accentColor};}</style>`;
const styleTag = `<style>:root {--ghost-accent-color: ${accentColor};}</style>`;
const existingScriptIndex = _.findLastIndex(head, str => str.match(/<\/(style|script)>/));
if (existingScriptIndex) {

View file

@ -1570,7 +1570,7 @@ describe('{{ghost_head}} helper', function () {
}
})).then(function (rendered) {
should.exist(rendered);
rendered.string.should.containEql('<style>:root {--accent-color: #123456;}</style>');
rendered.string.should.containEql('<style>:root {--ghost-accent-color: #123456;}</style>');
done();
}).catch(done);
});
@ -1591,7 +1591,7 @@ describe('{{ghost_head}} helper', function () {
}
})).then(function (rendered) {
should.exist(rendered);
rendered.string.should.not.containEql('--accent-color');
rendered.string.should.not.containEql('--ghost-accent-color');
done();
}).catch(done);
});