generator-jhipster-yellowbricks-angular-contextpath
v2.0.1
Published
JHipster blueprint to configure Angular application baseHref via a custom context path
Downloads
51
Maintainers
Readme
generator-jhipster-yellowbricks-angular-contextpath
One of - a JHipster blueprint that sets the Angular
baseHref in angular.json and prefixes the proxy routes in proxy.config.mjs to a configurable context path.
JHipster source
- Generator:
generators/angular - Templates:
angular.json.ejs,proxy.config.mjs.ejs
What it does
Patches angular.json during generation to insert baseHref as the first key in build.options:
"architect": {
"build": {
"builder": "@angular-builders/custom-esbuild:application",
"options": {
+ "baseHref": "/jh/",
...Patches proxy.config.mjs to prefix the proxy route pattern with the context path so that dev-server requests are forwarded correctly:
- '^/(api|management|v3/api-docs...)': {
+ '^/jh/(api|management|v3/api-docs...)': {The value is configurable — any context path can be used.
Prerequisites
- Node.js
^22.18.0 || >=24.11.0 - JHipster 9
Installation
npm install -g generator-jhipster-yellowbricks-angular-contextpathUsage
Create a .yo-rc.json in your project directory with the desired context path:
{
"generator-jhipster-yellowbricks-angular-contextpath": {
"contextPath": "/jh/"
}
}Replace /jh/ with your actual context path. The trailing slash is required.
Then run JHipster with this blueprint:
# Standard generator
jhipster --blueprints yellowbricks-angular-contextpath
# With JDL
jhipster import-jdl your-app.jdl --blueprints yellowbricks-angular-contextpath