I have been using the yeoman webapp generator (0.5.0) and my app directory is structured like this:
app/
├── dir1
│ └── index.html
├── favicon.ico
├── images
├── index.html
├── robots.txt
├── scripts
│ └── main.js
└── styles
└── main.css
In dir1/index.html
, I have copied the content of app/index.html
and modified the paths of css and js files. For example, changing from
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="styles/main.css">
to
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="../styles/main.css">
When using grunt serve
, everything works fine. However, after building with grunt build
, the paths in dir1/index.html
are incorrect. Errors are showing up in the chrome developer console:
GET http://127.0.0.1/webapp/dir1/styles/9c307a9d.vendor.css 127.0.0.1/:1
GET http://127.0.0.1/webapp/dir1/scripts/b6c3df09.main.js (index):8
The correct paths should be:
http://127.0.0.1/webapp/styles/9c307a9d.vendor.css
http://127.0.0.1/webapp/scripts/cb7562c6.plugins.js
This issue arises because a grunt task is using dir1
as the root directory instead of the parent directory.
How can I resolve this?