mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
2c6d43a0c0
no issue - Split theme helpers into individual files for each - Do the same for tests - Have utils to share some things between them - Move assetHash onto config
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
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'),
|
|
_ = require('lodash'),
|
|
config = require('../config'),
|
|
filters = require('../filters'),
|
|
utils = require('./utils'),
|
|
ghost_foot;
|
|
|
|
ghost_foot = function (options) {
|
|
/*jshint unused:false*/
|
|
var jquery = utils.isProduction ? 'jquery.min.js' : 'jquery.js',
|
|
foot = [];
|
|
|
|
foot.push(utils.scriptTemplate({
|
|
source: config.paths.subdir + '/public/' + jquery,
|
|
version: config.assetHash
|
|
}));
|
|
|
|
return filters.doFilter('ghost_foot', foot).then(function (foot) {
|
|
var footString = _.reduce(foot, function (memo, item) { return memo + '\n' + item; }, '\n');
|
|
return new hbs.handlebars.SafeString(footString.trim());
|
|
});
|
|
};
|
|
|
|
module.exports = ghost_foot;
|