Jump to:

23360 Posts in 18097 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » [solved] 'combine_files' and 'set_combine_files_folder'

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 418 Views
  • prawnstar
    Avatar
    Community Member
    116 Posts

    [solved] 'combine_files' and 'set_combine_files_folder' Link to this post

    I'm trying to combine my css files to reduce http requests. Using the tutorial on SSBits and the SilverStripe doc page here, it doesn't appear that the files are actually being combined. I'm using SS v 2.4.5.

    I have done:
    http://www.mysite.com/?flush=1
    As well as, manually creating the /themes/mysite/combinedfiles folder and set the permissions of the combinedfiles folder to 777.

    When I view-source I see:

    <link rel="stylesheet" type="text/css" href="http://www.mysite.com/themes/mytheme/css/typography.css?m=1308638710" />
    <link rel="stylesheet" type="text/css" href="http://www.mysite.com/themes/mytheme/css/layout.css?m=1323291670" />
    <link rel="stylesheet" type="text/css" href="http://www.mysite.com/themes/mytheme/css/form.css?m=1308638711" />
    <link rel="stylesheet" type="text/css" href="http://www.mysite.com/sapphire/css/SilverStripeNavigator.css?m=1308636999" />

    Can anyone see what it is that I'm doing wrong?

    _config.php

    SSViewer::set_theme('mytheme');

    Page.php

    class Page_Controller extends ContentController {
       public function init() {
          parent::init();

       //set css folder
          $themeFolder = $this->ThemeDir();
       //set the folder to our theme so that relative image paths work
          Requirements::set_combined_files_folder($themeFolder . '/combinedfiles');
       //combine css to array
          $CSSFiles = array(
             $themeFolder . '/css/typography.css',
             $themeFolder . '/css/layout.css',
             $themeFolder . '/css/form.css'
          );
       //require combined css
          Requirements::combine_files("combinedCSS.css", $CSSFiles);
       }
    }

  • prawnstar
    Avatar
    Community Member
    116 Posts

    Re: [solved] 'combine_files' and 'set_combine_files_folder' Link to this post

    I didn't notice this earlier, but because of issues with UserForms I had set "Requirements::set_combined_files_enabled(false);" in my _config.php file. Grrr!

    418 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.