My current task involves building my application with the following code:
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 am trying to find a way to access the rootPath
from within the application, like this:
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`;
}
}
...
So far, I have not been able to find a straightforward method. It is challenging for me to figure out how to access the application configuration during build time from within the app.