Jonas A
08/14/2024, 10:42 AMjavascripts directory (to keep the library structure intact), but I’m getting 404 errors.
My Setup:
• Grails Version: 6.x
• *Asset Directory Structure:*grails-app/assets/javascripts/ext/pdf-express/lib/
• ├── core/
• ├── ui/
• │ ├── assets/
• │ ├── chunks/
• │ ├── i18n/
• │ ├── configorigin.txt
• │ ├── index.html
• │ ├── style.css
• │ ├── webviewer-ui.min.js
• └── webviewer.min.js
• References in GSP Files:
• html
• link rel=“stylesheet” href=“${resource(dir: ‘javascripts/ext/pdf-express/lib/ui’, file: ‘style.css’)}” /
• script src=“${resource(dir: ‘javascripts/ext/pdf-express/lib/ui’, file: ‘webviewer-ui.min.js’)}“/script
• script src=“${resource(dir: ‘javascripts/ext/pdf-express/lib’, file: ‘webviewer.min.js’)}“/script
The Problem:
When I load my page, I get 404 errors for the CSS and JS files under the
ui directory:
• GET <https://mydomain/static/javascripts/ext/pdf-express/lib/ui/style.css> 404
• GET <https://mydomain/static/javascripts/ext/pdf-express/lib/ui/webviewer-ui.min.js> 404
• GET <https://mydomain/static/javascripts/ext/pdf-express/lib/webviewer.min.js> 404
What I’ve Tried:
• I haven’t yet configured application.yml specifically for this but suspect that the Asset Pipeline might not be set up to serve files from the javascripts folder when those files aren’t JS files.
• I’ve been advised to include these directories explicitly in the application.yml, but I’d like to confirm the best practice before proceeding.
application.yml
grails:
assets:
includes:
# Include all files for PDF.express view PDF library so css and images can be served from javascript folder
- 'javascripts/ext/pdf-express/lib/**/*'
What I’m Asking:
• Has anyone successfully served CSS and UI files from within the javascripts directory?
• Is there a recommended way to configure the Grails Asset Pipeline to handle this setup without moving files?
Any advice or configuration examples would be greatly appreciated!
Thanks in advance for your help!James Fredley
08/14/2024, 2:59 PM<link rel="stylesheet" href="${resource(dir: 'ext/pdf-express/lib/ui', file: 'style.css')}" />
• <script src=“${resource(dir: ‘ext/pdf-express/lib/ui’, file: ‘webviewer-ui.min.js’)}“></script>
• <script src=“${resource(dir: ‘ext/pdf-express/lib’, file: ‘webviewer.min.js’)}“></script>
or you can double up the directory assets/javascripts/javascripts and the resources will end up in assets/javascriptsJonas A
08/16/2024, 12:49 PM