How to get the CSS that was defied on another page?

Asked

Viewed 800 times

1

Hello, I’m new in front-end development, sorry if my question is a bit rough, but what I would like to know is if it is possible to get the CSS file that was set in a page and uses that same CSS in the others. This project uses Velocity, so I was thinking of something like:

A file called style.vm for example

<HTML>
   <HEAD>
       #IF(cliente == 1)
       <link rel="stylesheet" type="text/css" href="cliente1.css">
       #ELSE IF (cliente == 2)
       <link rel="stylesheet" type="text/css" href="cliente2.css">
       #ELSE IF (cliente == 3)
       <link rel="stylesheet" type="text/css" href="cliente3.css">
       #ELSE IF (cliente == 4)
       <link rel="stylesheet" type="text/css" href="cliente4.css">
       .
       .
       .
       #END
   <HEAD>
</HTML>

and the other . Vms and . Jsps get the css that was set in that file because they didn’t want to copy all these Ifs for each file in the project. I have the option to use Jquery if necessary, as all pages in this project matter Jquery.

  • Did Daniel Omine’s answer answer answer your question? If so, mark his answer as the answer. Learn how on tour.

2 answers

2

I could do it this way

<link rel="stylesheet" type="text/css" href="cliente[$cliente].css">

That’s all it takes, I wouldn’t need the if parole.

Obs: in place of [$cliente], put the variable cliente of "Velocity"

0

Usually when a client is logged in to the system he takes this information from Session, what you could do is define different themes for the systems, and assign a theme that would call the css file. For this I think you should use some language for the back end of the application if you do not use.

Thus storing the data in a database you could print in the style link the theme of the user accessing.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.