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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

Requirements Combined Files

Go to End

3 Posts   2703 Views


Community Member, 541 Posts

20 March 2010 at 1:19pm

So I was browsing through the requirements class in 2.4 beta and I spotted the set_combined_files_enabled() method. I was wondering if this is meant to combine all individual CSS / JS files into one master file and load that instead (in a similar way to Plone)?

If so, is this functionality still under development? I tried setting the method to true, but it didn't seem to do anything.

Any advice?




Forum Moderator, 5523 Posts

20 March 2010 at 3:01pm

Edited: 20/03/2010 3:15pm

This has actually been round for quite a while, well you'll find it in 2.3. Can't remember when it was added.

It works in tandem with the Requirements::combine_files() function. You define which files you would like to group like

Requirements::combine_files('myapp.js', array('myapp1.js', 'myapp2.js'));

and it will combine myapp1 and myapp2 into myapp. Its not documented on so I don't blame anyone for not seeing this functionality before!.

Edit: added some documentation to that page -

One piece of functionality I don't like is on devmode it doesn't default back to including each individual file, it just returns false so you need to include your files the standard way, then include that line after it.

Fred Condo

Community Member, 29 Posts

16 April 2010 at 5:44am

I'd advise not using this feature until the bugs have been worked out. It can get into a mode where it breaks the site tree in the CMS. By watching FireBug's console, I can tell this happens as soon as it loads assets/_combinedfiles/cmsmain.js