mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 08:31:43 +03:00
3cea203459
no issue 🔥 Remove adminHbs concept from tests 🔥 Get rid of unnecessary helper test utils 🔥 Remove helper missing code - this hasn't been registered / used for ages 😱 - gscan no longer allows us to activate themes that have missing helpers, so this wouldn't be used anyway TODO: consider whether we should make a way to override this? 🎨 Reduce coupling inside of /helpers 🎨 Use settingsCache in ghost_foot ✨ Labs util for enabling helpers 🎨 Move loadCoreHelpers to blog - This needs a proper home, but at the very least it doesn't belong in server/app.js! 🎨 Use settingsCache in ghost_head
31 lines
838 B
JavaScript
31 lines
838 B
JavaScript
// # Ghost Foot Helper
|
|
// Usage: `{{ghost_foot}}`
|
|
//
|
|
// Outputs scripts and other assets at the bottom of a Ghost theme
|
|
//
|
|
// We use the name ghost_foot to match the helper for consistency:
|
|
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
|
|
var hbs = require('express-hbs'),
|
|
SafeString = hbs.handlebars.SafeString,
|
|
_ = require('lodash'),
|
|
filters = require('../filters'),
|
|
settingsCache = require('../settings/cache'),
|
|
ghost_foot;
|
|
|
|
ghost_foot = function ghost_foot() {
|
|
var foot = [],
|
|
codeInjection = settingsCache.get('ghost_foot');
|
|
|
|
if (!_.isEmpty(codeInjection)) {
|
|
foot.push(codeInjection);
|
|
}
|
|
|
|
return filters
|
|
.doFilter('ghost_foot', foot)
|
|
.then(function (foot) {
|
|
return new SafeString(foot.join(' ').trim());
|
|
});
|
|
};
|
|
|
|
module.exports = ghost_foot;
|