mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 17:32:15 +03:00
e25f1df0ae
- This comment removes the block on themes controlling card assets via config - It also changes the default behaviour from "false" config (doing nothing) to excluding bookmark and gallery card assets - This is essentially the same thing, as only bookmark and gallery card assets exist at the moment, but it's being done because it makes this feature future-proof for all theme developers. - As we add new cards, all themes will automatically get the assets to make them work - As theme developers want to, they can create their own custom assets and disble assets for any cards they support by adding them to the exclude list - They can also remove any custom code they currently have to support bookmark and gallery cards, and set card_assets: true in package.json to use the defaults instead
14 lines
443 B
JavaScript
14 lines
443 B
JavaScript
const _ = require('lodash');
|
|
const defaultConfig = require('./defaults');
|
|
const allowedKeys = ['posts_per_page', 'image_sizes', 'card_assets'];
|
|
|
|
module.exports.create = function configLoader(packageJson) {
|
|
let config = _.cloneDeep(defaultConfig);
|
|
|
|
if (packageJson && Object.prototype.hasOwnProperty.call(packageJson, 'config')) {
|
|
config = _.assign(config, _.pick(packageJson.config, allowedKeys));
|
|
}
|
|
|
|
return config;
|
|
};
|