@appsemble/node-utils
Version:
NodeJS utilities used by Appsemble internally.
15 lines • 617 B
JavaScript
import { assertKoaCondition } from '@appsemble/node-utils';
export function createBlockCssHandler({ getApp, getAppBlockStyles }) {
return async (ctx) => {
const {
// @ts-expect-error Messed up
params: { name }, } = ctx;
const app = await getApp({ context: ctx });
assertKoaCondition(app != null, ctx, 404, 'App not found');
const appBlockStyles = await getAppBlockStyles({ app, name, context: ctx });
const [style] = appBlockStyles;
ctx.body = style ? style.style : '';
ctx.type = 'css';
};
}
//# sourceMappingURL=blockCssHandler.js.map