0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/server/services/themes/config/index.js
Fabien O'Carroll c2275ed131
Added size attribute support to img_url helper (#10182)
refs #10181 

Adds support to request a size in the img_url helper using syntax like:
    <img src="{{img_url profile_image size="small"}}"/>

Requires the image_sizes config to be defined in the themes package.json
2018-12-13 19:14:08 +07:00

13 lines
399 B
JavaScript

var _ = require('lodash'),
defaultConfig = require('./defaults'),
allowedKeys = ['posts_per_page', 'image_sizes'];
module.exports.create = function configLoader(packageJson) {
var config = _.cloneDeep(defaultConfig);
if (packageJson && packageJson.hasOwnProperty('config')) {
config = _.assign(config, _.pick(packageJson.config, allowedKeys));
}
return config;
};