1

Is it possible to access the configuration from CakePHP(3.x) in a CSS file?

For example I would like to define a general background color in the CakePHP configuration file and use it in multiple CSS definitions.

I am aware of CSS preprocessors like "LESS" or "SASS" but this isn't suited for our needs.

Has anybody a good idea or workaround for this?

Thomas L.
  • 11
  • 1

1 Answers1

0

CSS files are not parsed by PHP.

You have 3 choices:

1) generate and write a css file with the rules you need (on the fly or better with any cache logic)

2) old fashion school, create different css and call the one you need on a case by case situation.

3) tell PHP to parse CSS files, there are several ways to do that like using htaccess

Community
  • 1
  • 1
David A.
  • 91
  • 4