Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

CSS file/s is being loaded twice - Silverstripe 3


Reply


5 Posts   1237 Views

Avatar
ss_poser

Community Member, 1 Post

13 August 2012 at 2:30am

hi,

i have this code in my project that combine all the css files into one file.

Page.php

   public function init() {
      parent::init();

      //Set our theme's root folder
$themeFolder = $this->ThemeDir();

//Add all the files to combine into an array
$CSSFiles = array(
$themeFolder . '/css/reset.css',
$themeFolder . '/css/fonts.css',
$themeFolder . '/css/style.css',
$themeFolder . '/css/coupons.css'
);

//Set the folder to inside our theme so that relative css image paths work
Requirements::set_combined_files_folder('assets/' . 'combinedfiles');

//Combine!
Requirements::combine_files("combinedCSS.css", $CSSFiles);

   }

without calling it in the template, it is being loaded twice.

I also tried including all my css files in the template, but the same thing also happened. They are loaded twice.

it will be much appreciated if someone can help me on this.

Thanks!

Avatar
t|m

Community Member, 19 Posts

27 August 2012 at 6:38pm

Hi there,

am experiencing the same problem.
Looks very much like a bug.

Can you confirm that your <head></head> is in an included template?

Cheers

Avatar
Julius0815

Community Member, 3 Posts

6 September 2012 at 10:10pm

Hi there,

any news on this ?

Avatar
Willr

Forum Moderator, 5513 Posts

7 September 2012 at 9:48pm

Created ticket - http://open.silverstripe.org/ticket/7847

Avatar
t|m

Community Member, 19 Posts

8 September 2012 at 12:31am

Thanks!