Geeks-Solutions / nuxt-sections

MIT License
2 stars 1 forks source link

Let users store and use custom CSS per page #69

Closed akramsarkis closed 3 weeks ago

akramsarkis commented 1 month ago
Screenshot 2024-10-18 at 16 40 09

Acceptance testing

mahfouzhseineweev commented 1 month ago

The 3 CSS presets for a specific UI each are for what exactly ? Themes for section controls in Admin edit mode ?

The idea is clear however this needs more elaboration and grooming to be done correctly and the updates needed on the library are quite big to support this feature as we are going to change the way css is currently set to have specific classes per elements, a part of this was done in the cname update.

I can't give a correct estimation for this one but I can give a range of 5-8h

mahfouzhseineweev commented 3 weeks ago

After discussion with Julien:

The goal is to rely on tailwind configs to speed up the setting of some styles. But to also allow feeding custom css styles too.

  1. Define the standard as part of the preset+custom css feature in the nuxt-sections Library (document it) ⚠️ Do not reinvent the wheel and rely on the standards provided by tailwind

  2. Implement the standard in 1. inside the sections that ship with the vue-cli-plugin

  3. Create presets following the standard (a preset will work the same way as a custom css it's just that it's made available to use out of the box to users)

  4. Create a custom css that follows the standard too

The presets can be uploaded as medias on Sections website project and we use the links from there We could simplify things and define as many presets as we want through env variable by putting a json made of the preset name and the url to the file That way we could edit the presets on the go

mahfouzhseineweev commented 3 weeks ago

@akramsarkis

1) Just for now as I don't have access to sections website prod, I have uploaded the presets on sections dev as Preset 1, Preset 2, Preset 3. Please do not update these files directly

2) For your QA use the sections of blogs as they are the ones that are following the css Tailwind rules standards and skip the other sections that are for sections website which will be removed later

You can use the page I was using that is /blogs

The following ENV variable should be added to meta sections env variables on rancher:

NUXT_ENV_SECTIONS_CSS_PRESET=[{\"name\": \"Preset 1\", \"url\": \"https://s3.amazonaws.com/eweevtestbucketprivate/sections/preset1f5bee855a36c43708a8c7b801864715c.css\"},{\"name\": \"Preset 2\", \"url\": \"https://s3.amazonaws.com/eweevtestbucketprivate/sections/preset2127eaa90b85f48798c16665f2a96cf5a.css\"},{\"name\": \"Preset 3\", \"url\": \"https://s3.amazonaws.com/eweevtestbucketprivate/sections/preset3348a13214941498bb6391ab43ae5d057.css\"}]

akramsarkis commented 3 weeks ago

@mahfouzhseineweev please find below my feedbacks

akramsarkis commented 3 weeks ago

When exporting preset1 it is not working and in the console there is the below error:

Screenshot 2024-11-01 at 08 51 30

And here answer of Hussein:

Hussein Mahfouz

A CORS error which is not from my side. In all cases, the amazon links will be moved to sections website prod account. So we will revisit this one later on, nothing can be done from my side for it

akramsarkis commented 3 weeks ago

@jfayad all good but there is just the comment above about Preset1 if you can check it, for the other preset I can export them without any problem.

For now Hussein put them as static as you were not there to add them as env variable, he will adjust it once you are there

jfayad commented 3 weeks ago

@mahfouzhseineweev when adding a custom css (or using a preset) how is the impact on the performance ?

mahfouzhseineweev commented 3 weeks ago

@jfayad For the presets, I used main standard classes that will not affect the performance and they just override existing Tailwind classes (colors, fonts etc...)

For the custom css uploaded, it will depend on the content of the CSS, and if these CSS classes are used in the page or not. If they are not used it will increase the Unused CSS but according to page speed it wont have a noticeable impact unlike the unused scripts and the large containtfull painting

jfayad commented 3 weeks ago

noted, LGTM

akramsarkis commented 3 weeks ago

@mahfouzhseineweev you are using a fetch type when downloading a preset file which is causing the CORS from amazon , you need to checj what you can use maybe Get in instead of Fetch

mahfouzhseineweev commented 3 weeks ago

@akramsarkis But then why would it work for a file and not for another ?

akramsarkis commented 3 weeks ago

@akramsarkis But then why would it work for a file and not for another ?

Well @mahfouzhseineweev no idea but this is Julien that mention this , I just added it there

jfayad commented 3 weeks ago

@mahfouzhseineweev make sure the user can also choose to not have any preset nor custom css file on his page

mahfouzhseineweev commented 3 weeks ago

@jfayad Already the case

akramsarkis commented 3 weeks ago

All good, closing