mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
fdf38ba8c6
- Requires the new @tryghost/minifier package - Adds a new service that will handle taking config from the theme and optionally including assets for Koenig editor cards - It supports both css and js as cards may need one or both - For any given config, the tool can find the matching files to include and concat and minify them into one file per type - Currently has an override in place so that this is not yet customisable in the theme - will remove this override when we're ready for the feature
18 lines
629 B
JavaScript
18 lines
629 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));
|
|
}
|
|
|
|
// @TOD0: remove this guard when we're ready
|
|
// Temporary override to prevent themes from controlling this until we're ready
|
|
config.card_assets = defaultConfig.card_assets;
|
|
|
|
return config;
|
|
};
|