roadhog-extra
Version:
Cli tool for serve and build react app, based on create-react-app, support JSON pattern config.
16 lines (13 loc) • 404 B
JavaScript
import { resolve } from 'path';
export default function getTheme(cwd = process.cwd(), { theme }) {
if (theme) {
if (typeof theme === 'string') {
const themeFile = resolve(cwd, theme);
const themeConfig = require(themeFile); // eslint-disable-line
return typeof themeConfig === 'function' ? themeConfig() : themeConfig;
} else {
return theme;
}
}
return {};
}