File Generation System

AT Core 7.x-3.x makes heavy use of generated stylesheets and saves its own configuration as a backup. This page is about those files, how they are generated, where they are saved, how you can make use of them, and some tips on when things might go wrong.

Adaptivetheme will generate up to eight files. These are not all loaded at once - it depends on entirely on your theme settings which files are actually populated and loaded by the theme. Nevertheless AT does not care about this, it generates the files and if they are not used will set a comment into the file telling you why its not being used - you can always open these files and read the comments to find out why this or that file is being loaded or not.

Take it as read - there is a distinct separation between file generation and file loading. File loading is handled in and is in reality a distinct and separate system to be covered in another help page. This is about the generated files themselves.

Where are these files saved?

All files are saved to the public files system in your Drupal site. By default this will be in:


Changing the files directory

You can configure the location of the generated files. You can leave it as the default, choose to save them in your subthemes folder or to a custom path. This feature was added to ease migration and to allow for files to be committed to version control, since generally the public files directory is not committed to version control due to its size and volatility.

To change the location of the generated files go to the appearance settings for your theme, then see Layout & General Settings > CSS > Path to Generated Files. From there it should be self explanatory how to configure your changes.

When do these files get generated?

Every time you save the theme settings an entire new set of files is generated. The old files and directory are removed and the link to the new files is updated. If you accidentally delete these files, don't worry, just save the theme settings again and they will be regenerated. Note that if Adaptivetheme cannot find these files you will get warned about this, see the section about warnings at the end of this page.

About the files

Six files are generated by default.

  • Four are for handling the layout and are populated and loaded depending on your theme settings - for example if you are in Production or Development mode, if you are doing mobile or desktop first, or if you have Respond.js turned on or off.
  • One holds all the responsive styles embedded in media queries.
  • One saves the themes configuration in a duplicate info file, this is all the info file data and the current theme settings (taken from the form).
  • If you have the Fonts extension turned on a fonts CSS file will get generated.

Finally if you have Color module turned on an additional configuration file is saved, this is literally a duplicate of in your theme, however it will include a custom color scheme if you made one in the UI. If you build color themes you will understand how powerful that is and how useful it will be for migration and development.

If you look in public files you will see the files, something like this:

  • foobar.default.layout.css
  • foobar.responsive.layout.css
  • foobar.responsive.styles.css
  • foobar.fonts.css

What about this info file?

The file includes all your info file data and all the current theme settings as you have saved them on the appearance page. In short this is your themes "configuration" saved to file, and no longer trapped in the database where its vulnerable. This gives you a great tool to capture your config for migration or simply to hold as a backup should disaster strike.

When you are ready to migrate and have all your theme settings worked out you can copy the contents of the info file to your themes info file (over write all data in that file) and you are done. This can be very useful for theme developers who seldom have the luxury of being able to migrate the database they are using for theme development.

What about this color inc file?

This is a copy, or a var_export, of the color inc settings array. It holds the entire default array. Its can be used as is, out of the box, to replace your file. If you have set a custom color scheme this will be captured and injected into the settings array.

In the generated files you will find a file called Normally you will find this file in sites/default/files/adaptivetheme/themename_files/.

This is an example of what you will find when you create a custom color scheme, note that the first array key is empty (and it is always the last scheme array), it looks something like this (note the title is "Custom"):

    '' =>
    array (
      'title' => 'Custom',
      'colors' =>
      array (
        'base' => '#ffffff',
        ... etc ...

What you do is add this to your themes default file, you find this in your theme in the color folder. Enter a key for for the scheme and change the title, e.g.

    'mycustomscheme' =>
    array (
      'title' => 'My Custom Scheme',
      'colors' =>
      array (
        'base' => '#ffffff',
        ... etc ...

Note that if you change the custom scheme and have not backed up this file or copied the scheme to your file it will be overwritten when you save the theme settings.

AT does not over-write your themes default file as this could be dangerous, i.e. if something goes wrong it could leave it corrupted, or permissions could be an issue.

Can I edit these files?

Yes, you can, however be warned that as soon as you save the theme settings again the path will change to take the latest generated set. Best practice - don't edit these files, they are not meant for humans to edit. Stick to theming in your theme, these files are by and large for machines to worry about.

I'm getting a warning that files don't exist or are not found.

If Adaptivetheme cannot find the files it needs it will set a warning message on the screen and a watchdog error. That may be how you came to this page!

There are a couple of reasons why this might happen:

  • You migrated but did not migrate the files directory. This is common for sites being built in VCS (version control systems) where the files directory is excluded from version control. In this case you will either need to migrate the files directory or re-save the theme settings to regenerate the files.
  • You deleted or moved the files. Re-save the theme settings to regenerate the files.
  • Permissions issues - Drupal cannot write to the public files directory. Check in admin/config/media/file-system for warnings. Check your server directory level permissions and ownership. This is not a theme issue, its sever level permissions issue. If Drupal cannot write to public files then your site is going to experience far more problems than just this theme not finding its files. In short, this has to be fixed for you to even run a Drupal site correctly.
  • The path to the files is wrong - this would be extremely rare, in more than 1000 theme settings saves this never happened to me, but it could (at least theoretically), it would require variable_set() or variable_get() to fail, something very rare indeed.

Note that due to the way AT Core and Drupal cache data you may get a "ghost" warning after you save re-saved the theme settings, try reloading the page and it should go away if the file generation was successful. Also - watchdog won't know the reason for the failures, so you will need to work through these and figure it out, sorry, there are no shortcuts. Issues are rare, and mostly are migration issues or permissions issues.

I changed some files in my theme and get the warning message also!

AT 7.x-3.x sub-themes include six responsive styles stylesheets in the sub-theme. You cannot delete or move these files if you are using the responsive capability of the theme AND you are in Production mode. If you do, then you will get a warning message and watchdog errors about these files. These files are:

  • responsive.smartphone.landscape.css
  • responsive.smartphone.portrait.css
  • responsive.tablet.landscape.css
  • responsive.tablet.portrait.css
  • responsive.desktop.css
  • responsive.cascade.css

Other than adding styles to these files do not delete, move or rename them!

Last updated 2nd January, 2013 - 7:40pm