Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {Map} from 'immutable';
import filters from '../server/filters';
import extensions from '../server/extensions';
import {getEnvWithGlobalsExtensionsAndFilters} from '../server/view/env-utils';
import {createPageConfig} from '../server/model/page-config';
import statuses from './config/statuses';
const fractal = Fractal.create();
const root = serverDir('views');
// We need to set this up because Fractal doesn't allow us to specify our own
// nunjucks env, but rather uses config to set it up.
const nunjucksEnv = getEnvWithGlobalsExtensionsAndFilters(root, Map());
const extensionsWithEnv = extensions.map(Extension => new Extension(nunjucksEnv));
const nunjucks = Nunjucks({
paths: ['./../server', root],
filters: filters.toJS(),
extensions: extensionsWithEnv.toJS(),
globals: {
pageConfig: createPageConfig({ title: 'Cardigan', inSection: 'explore', path: '/' })
}
});
fractal.components.engine(nunjucks);
fractal.set('project.title', 'Design system');
fractal.components.set('path', root);
fractal.components.set('statuses', statuses);
fractal.components.set('default.status', 'wip');
fractal.components.set('ext', '.njk');
fractal.components.set('default.preview', '@preview');