CMS Development

DanielSanchez
Conselheiro(a) de destaque | Parceiro Platinum
Conselheiro(a) de destaque | Parceiro Platinum

Can i use values of fields in custom module to customize css file out of module?

resolver

Hi, 

 

I create my custom modules with fields customizating the inline style of this modules.

 

But not is good insert inline styles for each customization i will create in my module. 

 

Is possible i use the value of one field in custom module to customization my stylesheet out of the module, so not including CSS sheets and inline CSS to each module?

0 Avaliação positiva
1 Solução aceita
alyssamwilie
Solução
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro Elite

Can i use values of fields in custom module to customize css file out of module?

resolver

You can't even add custom module values into the styles section of the custom module itself so I don't think it's possible to add custom modules values into a stylesheet either. Hubl in a stylesheet is rendered and minified once the sheet is published so it wouldn't be able to grab variables from the template.

The best we can do is limit the customization and just create classes in the module based on the options. (Ex: a choice field named bacground_color with 'dark, light, alpha, beta, etc' and in the HTML of the module put :
class="background-{{ module.background_color }}")

Alyssa Wilie
Web Developer

LyntonWeb

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

Exibir solução no post original

3 Respostas 3
alyssamwilie
Solução
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro Elite

Can i use values of fields in custom module to customize css file out of module?

resolver

You can't even add custom module values into the styles section of the custom module itself so I don't think it's possible to add custom modules values into a stylesheet either. Hubl in a stylesheet is rendered and minified once the sheet is published so it wouldn't be able to grab variables from the template.

The best we can do is limit the customization and just create classes in the module based on the options. (Ex: a choice field named bacground_color with 'dark, light, alpha, beta, etc' and in the HTML of the module put :
class="background-{{ module.background_color }}")

Alyssa Wilie
Web Developer

LyntonWeb

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
DanielSanchez
Conselheiro(a) de destaque | Parceiro Platinum
Conselheiro(a) de destaque | Parceiro Platinum

Can i use values of fields in custom module to customize css file out of module?

resolver

@alyssamwilie 

Really a great idea !! Use fields to create classes instead of customizing. Thank you! 

sharonlicari
Gerente da Comunidade
Gerente da Comunidade

Can i use values of fields in custom module to customize css file out of module?

resolver

Hey @DanielSanchez 

 

I will tag a few devs that can share with you some tips about this. 

 

Hey @alyssamwilie @Jon_McLaren @AlexanderData could you please advise @DanielSanchez ?

 

Thank you

Happy Monday

Sharon 


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !