Jump to content

How to add new css into $css_files array


xezus

Recommended Posts

Hi,

 

I would like to add a new css into my project, but I don't know how to add it into the $css_files array. And I don't want to add it just into the header. I would like to keep simple clarity.

 

The position of my new css is in the theme/css.

 

Thanks for any replies.

Link to comment
Share on other sites

  • 2 years later...

You can simply use $this->context->controller->addCSS(path....);

 

You've got to do it from a module, of course (or page)

 

wink.png

Is that still applicable? Say I have removed google fonts from default-bootstrap and created a new file called opensans.css to define font-face with .woff files. Would I have to do this in header.tpl? If so, I need to do {php}...{/php} in the smarty file?

Link to comment
Share on other sites

Note that the "normal" `<link rel` way Nemo mentioned above will not compress and combine the css file when ccc is enabled. If you do not want to go through the trouble of creating an extra module just to include a css file you could also override the `setMedia()` function in one of the front controllers. In your case Denver Prophit i would override the FrontController.php and and put `$this->addCSS(_THEME_CSS_DIR_.'opensans.css');` above the `parent::setMedia();` call

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...