analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.57k stars 245 forks source link

Files in folder assets are moved at the root folder #636

Closed BenLune closed 1 year ago

BenLune commented 1 year ago

Please provide the environment you discovered this bug in.

serve command "nx": "16.8.0" "@angular/core": "16.2.3" "@analogjs/platform": "^0.2.0" "@analogjs/vite-plugin-angular": "^0.2.0"

Which area/package is the issue in?

Don't know / other

Description

In my apps, I use the assets folder to store fonts, icons, transloco files etc. The templates using it finds a file at this url, for example : ./assets/icons/icon-96x96.png As I try to migrate an existing app to AnalogJS, I have to rename all those urls. But my question is why is it done like that, or how is it possible to change it in the config file, or elsewhere ?

Please provide the exception or error you saw

No response

Other information

No response

I would be willing to submit a PR to fix this issue

brandonroberts commented 1 year ago

Thanks @BenLune. You don't have to rename all those URLs. In the vite.config.ts there is publicDir: 'src/assets', which points to where your assets are copied to at the root. If you want to have an assets folder inside there, create an assets folder and put your files in there.

Another option would be to use publicDir: 'src/public, and put your assets in src/public/assets. That way it's a little more clear and not a double folder.

BenLune commented 1 year ago

OK, thanks @brandonroberts !