Close

Preset with custom colors renders 354 lines of CSS in the head

dwright71
3 years ago
#12559 Quote
Avatar
  • 1
I should imagine most implementations would be using custom colors instead of the six presets available to choose from.  However, when using custom colors, we get 354 lines of CSS rendered in the head for every page request meaning there's no caching or bundling support available which is a significant limitation.

I've tried to copy the generated css and place it in a file of its own but there's no way of preventing the custom css from still being generated.

I would appreciate any help in resolving this issue or perhaps it might be possible to add the option of disabling css generation in a future release.
Stefan
3 years ago
#12572 Quote
Avatar
  • Moderator
  • 157
dwright71 wrote:
I should imagine most implementations would be using custom colors instead of the six presets available to choose from.  However, when using custom colors, we get 354 lines of CSS rendered in the head for every page request meaning there's no caching or bundling support available which is a significant limitation.

I've tried to copy the generated css and place it in a file of its own but there's no way of preventing the custom css from still being generated.

I would appreciate any help in resolving this issue or perhaps it might be possible to add the option of disabling css generation in a future release.


Hi dwright71,

I understand that it is not a recommended way of adding css, but we have implemented it in that way because of the multi-store support. We wanted to avoid generating a css file for each store in case of a multi-store scenario and that is way we have done it that way. You can get rid of the generated css by choosing the default color scheme (the first option in the administration) and save it. Then no additional css will be generated. You will just need to use your custom css file with your colors.

Note: you should check that you have the following settings present:

name: PavilionThemeSettings.DefaultPreset
value: f74258, 00a1b1

If it is missing, just add it from All Settings admin menu, clear your cache and then save the first default color scheme from the administration of the theme.
Best Regards,

Stefan Hristov
Nop-Templates.com
edgardoni
2 years ago
#13679 Quote
Avatar
  • 1
I have configured a custom color for my theme, sometimes when I deploy my site, the default color preset is active on the site, nevertheless in the preset configuration my custom color is still selected, I need to save my settings again to see my custom colors on the site.
Is this behaviour related to the way how the custom colors are managed?
Stefan
2 years ago
#13681 Quote
Avatar
  • Moderator
  • 157
Hi edgardoni,

Please see my reply from the nopCommerce forum post.

The reason that you need to save again the preset is because most probably when doing a deploy your are not uploading a file that is generated as a result of the preset. Each color combination is saved into a generated file called theme.custom-{storeId}.css file that can be found in Themes/Pavilion/Content/css. So when doing a deploy I assume you are deleting all old files and deploying the new ones excluding this custom file. So that is why when you save the preset in the administration again, the file is generated and the preset is applied. In order to fix this, just include the generated file in your deploy package.

Note: you should note that any other custom code added in the theme settings in the custom head styles textbox will be included there as well. So make sure that you have the same settings applied on your local and live server so that replacing this file will not cause any differences.

Hope that helps.
Best Regards,

Stefan Hristov
Nop-Templates.com