I have the following task that creates my application:
const app = new Metalsmith(config.styleguide.path.root); app.use( msDefine({ production: false, rootPath: '/' }) ); app.use( msIf( gutil.env.config === 'release', msDefine({ production: true, rootPath: '/styleguide/' }) ) ); app.build(...);
I need to access rootPath from an application, for example:
import stuff from 'stuff'; export class IconCtrl ... ... _getIconPath(name: string, size: string): string { switch (this.version) { case 'current': return `${stuff.rootPath()}/current/icn-${name}-${size}.svg`; default: return `${stuff.rootPath()}/legacy/${name}.svg`; } } ...
I have not yet found a clean way to do this. I am not sure how to access the application configuration during build from the application.
source share