Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create ALL files when needed a manual deploy? #103

Open
realtebo opened this issue Nov 20, 2023 · 5 comments
Open

How to create ALL files when needed a manual deploy? #103

realtebo opened this issue Nov 20, 2023 · 5 comments

Comments

@realtebo
Copy link

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
Copy link
Author

Could be related to #61 ?

@hagealex
Copy link

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.

@pxpm
Copy link
Contributor

pxpm commented Nov 21, 2023

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

@Antonin-netalis
Copy link

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.

@promatik
Copy link
Contributor

promatik commented Apr 7, 2024

@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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants