basset icon indicating copy to clipboard operation
basset copied to clipboard

How to create ALL files when needed a manual deploy?

Open realtebo opened this issue 7 months ago • 5 comments

Locally i set

BASSET_DEV_MODE=false
BASSET_VERIFY_SSL_CERTIFICATE=false

I execute basset:install

It creates this

image

But when I launch the first time the page, It add 2 more files

The 2 added files are added from config/backpack/theme-tabler.php

image

My question is: how can I force basset to internalize and store ALL but really ALL the needed files ?!?!

image

I cannot remember for ALWAYS reload website localy before deploy.

realtebo avatar Nov 20 '23 15:11 realtebo

Could be related to https://github.com/Laravel-Backpack/basset/issues/61 ?

realtebo avatar Nov 20 '23 15:11 realtebo

I might also need this. As mentioned in #104 I manually move the basset files from the storage folder into public. Therefor I need all files to be there at this moment. Files that are generated afterwards won't be accessible.

hagealex avatar Nov 21 '23 10:11 hagealex

Indeed @realtebo it's the same issue.

We are aware of it, I just had a meeting with @promatik yesterday to talk about this pending basset issues. As you can imagine they are the tricky ones, that are left to solve.

to give you an overview of what's the issue, basset is like a "scrapper". It checks your php files for @basset directives and cache the result of those assets.

Some assets are built "on the fly".

To give you a different example, datepicker and most of the select2 fields have a language .js file that is loaded depending on "run-time" values, in this case the app locale. So if the locale is fr it will load some-file.fr.js, if pt would load some-file.pt.js.

Those kind of files are the ones that you say "are created the first time they are encountered". So the first fr visitor would load the some-file.fr.js from the cdn, all the other visits from fr visitor would pick the cached file. When the first pt visitor comes in, we will cache the pt alongside the fr and the cycle repeats for any language your visitors may be using.

There are other examples of such cases, but the reason behind it is because they all depend on run-time values.

We are exploring possibilities of expanding the scrapping abilities or as a last resort if that can't be reliably achieved, we would probably cache ALL the available language files on the first basset:cache so any of them would be available in the cache.

I think this will be a "non-issue" for you when you implement the solution I gave you on the other thread you posted, since those files will be created just as "any other public file" and just works.

Let me know what you think.

Cheers

pxpm avatar Nov 21 '23 11:11 pxpm

Hey, thanks for the detailed explanation. It seems like a tough problem to solve.

Just thought I'd let you know that I'd also be really interested if there were a way to do this. Our codebase and assets are on entirely different VMs and we use rsync post-deployment to copy storage/app/public/basset to our nginx VM, but files that are created "on-the-fly" are not present at the moment we rsync, have to do a bit of manual action to load those files once after each deployment and rsync again.

If anyone has an idea how to make basset work flawlessly in this kind of setup, I'm interested.

Antonin-netalis avatar Feb 29 '24 16:02 Antonin-netalis

@pxpm what if we did some kind of tag or attribute? (Exactly like the PHP attributes)

'scripts' => [
    // @basset <- this thing right here
    // 'js/example.js',
    // 'https://unpkg.com/[email protected]/dist/vue.min.js',
    // 'https://unpkg.com/react@16/umd/react.production.min.js',
    // 'https://unpkg.com/react-dom@16/umd/react-dom.production.min.js',
],

That @basset would instruct basset to search for links on the following lines...

promatik avatar Apr 07 '24 21:04 promatik