silverstripe / silverstripe-s3

Silverstripe module to store assets in S3 rather than on the local filesystem (SS4/SS5 only)
BSD 3-Clause "New" or "Revised" License
20 stars 25 forks source link

Using combine_files() causes file to be uploaded to s3 but framework fails to provide a link to it #40

Open zanderwar opened 4 years ago

zanderwar commented 4 years ago
Requirements::combine_files('vendor.min.js', [
    'themes/default/node_modules/selectize/dist/js/standalone/selectize.min.js',
    'themes/default/javascript/rollbar.min.js'
]);

results in:

<script type="application/javascript" src="/"></script>

combined file is uploaded to s3 though

image

I'm not sure if this is a bug in the Requirements class, if you think this is just close it off and i'll create a ticket there

obj63mc commented 4 years ago

To use S3 and Requirements you will most likely need to extended the RequirementsBackend class and configure Silverstripe to use your class as default. Basically you will need to have your new class utilize the s3 urls. If I am correct the Requirements classes look at the local filesystem only for the combined assets and if the files don't exist it breaks.

Requirements functionality, if I am correct may be deprecated as now a days most people are using modern tooling for combining assets such as CSS preprocessors and is bundlers like webpack.

obj63mc commented 4 years ago

I would checkout the docs at https://docs.silverstripe.org/en/4/developer_guides/templates/requirements/#configuring-combined-file-storage

Basically your best course of action is to change the folder the combined assets get outputted to and setting configuration for how the filesystem looks for those files.