Reputation: 14801
I am working on a legacy SilverStripe project. I am trying to create a public folder with the name "files" inside the themes folder. All the files within that folder will be accessible through the browser.
I created a folder and created a file within it.
When I access the file within the folder from the URL, it is giving me 404 error. But when I access the files from the other folders like css, fonts, img and so on, it is working as expected. It is just not working for "files" folder which is the one I just created. Do I need to configure something?
Upvotes: 2
Views: 629
Reputation: 4626
You need to "expose" that folders in your project's composer.json
, so running composer vendor-expose
will symlink or copy the files to your public resources folder.
Your composer.json will look like this:
{
"name": "app/myproject",
"type": "silverstripe-project",
"require": {
"silverstripe/recipe-cms": "4.4.x-dev"
},
"extra": {
"resources-dir": "_resources",
"expose": [
"themes/mytheme/dist",
"themes/mytheme/files"
]
}
}
It's good practice to collect all generated exposable files (js, css) in a folder called "dist", this way you don't have to expose them seperately.
You can call composer vendor-expose
manually (e.g. on windows after every file change cause symlinks won't work under windows) and it's called automatically whenever you run composer install
or composer update
.
Upvotes: 3