The Webpack process loads files when they are used within an entry point. By default, these are the following entry points:
The assets within the resources/assets folder are expected to be used to build the styles and scripts associated with each entry point. Unless you reference the PDF within one of these files, then it will not be copied to the dist folder since that only includes the built files and their required assets. So it would be best to create your pdfs — or perhaps more filetype agnostically named documents — directory within resources and then link to them within that directory. Keep in mind that if you wanted to use asset_path() or @asset to load these documents, it will no longer work. You could make a new Blade directive easy enough though:
Thank you so much for your detailed answer @knowler!
Alright! I will try today what you suggest:
Place docs folder in resources instead of assets
Create new blade directive and try to link the files.
On the other hand, I have a similar issue, as this is an old project that I migrated to Sage and has a custom generated font in woff format. But I see this particular format, even being linked, it’s not being transported into dist folder:
Heya @SergiArias , this will work withing a template, but how do you call this withing a controller, like asset_path() for example (which is @asset in a template)? I guess you need a separate function that invokes a directive somehow?
With this method, your favicons wouldn’t be in dist since they aren’t being processed with webpack. The Blade directive is using the source path (resources/favicons). The final expected URI would be something like: /app/themes/sage/resources/favicons/apple-touch-icon.png.
I guess that would be my followup question – what do I need to add to the webpack config file or config.json in order to collect anything inside of resources/favicons and add it to dist/favicons?
Why does it need to be in dist/favicons and why do you need a custom directive for this? If I were you, I’d just put favicons in resources/assets/images and just use @asset instead. The @asset directive should be used for anything that webpack is generating.