I want to store static assets like css/js/fonts in the dxa-webapp instead of publishing it in Tridion.
I have seen one guide from Bart (DXA HTML design decisions) and also some topics here at StackExchange but no solution worked for us so far.
What i did:
- Unpublished and deleted the
Publish HTML Design
Page - Created a
version.json
in/src/main/webapp/system/assets
setting it to{"version":"v0.1"}
- I put some test css/js in
/src/main/webapp/system/assets/
- Went into my page view jsp and added
${markup.versionedContent('/assets/wc/main.css')}
- Rebuilt and re-deployed the web application
- When opening a page, the asset path gets resolved correctly into
/en/system/v0.1/assets/wc/main.css
including the version i specified inversion.json
The browser will return status 200 however the file size is always 0 byte:
It does not matter if i randomly change the file name, it will always resolve in status 200 - 0 byte.
I have tried out to use other locations to store assets beside of /system/assets/
like /content/styles/
but this was without success, too.
I have set the log level to TRACE to have a better look whats happening but since i never used DXA before i am not seeing anything special.
Request:
RequestMappingHandlerMapping - Found 1 matching mapping(s) for [/en/system/v0.1/assets/wc/main.css] : [{[/**],methods=[],params=[],headers=[],consumes=[],produces=[text/html || /],custom=[]}]
Getting localization, why do we even need this for static files without relation to any publication:
WebRequestContextImpl - Localization for http://mvp.dxa.local:8080/en/system/v0.1/assets/wc/main.css/en/system/v0.1/assets/wc/main.css is: [1206] /en
Strange things happening here as my understanding was, that this BinaryData folder is for database exclusive assets:
AbstractDefaultContentProvider - getStaticContentFile: C:_dev\workspaces\gitroot\linde-dxa-web-application-java\dxa-webapp\target\webapp-dxa\BinaryData\1206\en\system\assets\wc\main.css
Wait, why is there a publishing event?
AnnotationConfigWebApplicationContext - Publishing event in Root WebApplicationContext: ServletRequestHandledEvent: url=[/en/system/v0.1/assets/wc/main.css]; client=[127.0.0.1]; method=[GET]; servlet=[org.springframework.web.servlet.DispatcherServlet]; session=[DDED4DC30E12989DBD487107CFEF2E01]; user=[null]; time=[296ms]; status=[OK]
Finished request:
BasicEndpointCaller - Request ended with 201 status code.
I am really out of ideas currently. I was hoping that static assets in DXA work out of the box without the need to install and configure an apache webserver for local development.
Thank you for your help!