css/
styles.css
sass/
styles.scss
_base.scss
_layout.scss
_components.scss
components/
_blocks.scss
_nodes.scss
# Without Compass
$ sass --watch style.scss:style.css
# With Compass
$ compass watch
Breakpoint, Susy, Singularity, Globbing, Toolkit and many more!
Omega includes Bundler and a Gemfile to manage ruby dependencies.
Define general, default styling to be applied everywhere.
Separate major (layout) and minor (component) page elements.
A minor page element to be placed within a layout area.
/* Component */
.component {}
/* Sub-component */
.component__sub-component {}
/* Modifier */
.component--modifier {}
/* Reduced relience on specific HTML structure */
table.system-status-report tr.merge-up td {}
.merge-up td {}
/* Removed over specified selectors */
#blocks tr.region-message {}
.blocks-admin .region-message {}
/* Reduced qualified selectors */
div.contextual-links-wrapper {}
.contextual-links-wrapper {}
user.css user.base.css # Base functional styles.
user.theme.css # Stylistic assumptions.
user.admin.css # Administration styles.
layouts/
simple/
simple.layout.inc
preview.png
simple-layout.tpl.php
simple.layout.inc
name = Simple
description = A simple 3 column layout.
preview = preview.png
template = simple-layout
regions[header] = Header
regions[navigation] = Navigation bar
regions[highlighted] = Highlighted
regions[help] = Help
regions[content] = Content
regions[sidebar_first] = First sidebar
regions[sidebar_second] = Second sidebar
regions[footer] = Footer
stylesheets[all][] = css/layouts/simple/simple.layout.css
preview.png
simple-layout.tpl.php
<?php print render($page['header']); ?>
<?php print render($page['content']); ?>
layouts/
embedded/
embedded.layout.inc
embedded-layout.tpl.php
embedded.layout.inc
name = Embedded
description = Display site in an embedded mode.
template = embedded-layout
regions[content] = Content
embedded-layout.tpl.php
<?php print render($page['messages']); ?>
<?php print render($page['content']); ?>
/**
* Implements hook_omega_layout_alter().
*/
function hook_omega_layout_alter(&$layout) {
if (isset($_GET['embedded'] && $_GET['embedded'])) {
$layout = 'embedded';
}
}
<html>
classes
.my-component {
margin-bottom: 1em;
border: 1px solid red;
color: green;
@include breakpoint(800px, true) {
padding: 20px;
}
}
// Compiled CSS with media queries.
.my-component {
margin-bottom: 1em;
border: 1px solid red;
color: green;
}
@media screen and (min-width: 800px) {
.my-component {
padding: 20px;
}
}
// Compiled fallback CSS
.my-component {
margin-bottom: 1em;
border: 1px solid red;
color: green;
}
.my-component {
padding: 20px;
}
// Use breakpoint
@import "breakpoint";
$breakpoint-no-queries: true;
$breakpoint-no-query-fallbacks: true;
@import "styles";
*.no-query.css
.info
file, or using drupal_add_css()
[theme-hook].preprocess.inc
file in preprocess folder.inc
file, using the normal naming conventions.template.php
filehook_preprocess_block()
The design calls for some alternate block styling:
.block {
// Some Styles
}
.block--system-navigation {
// Some Styles
}
.block--search-form,
.block--system-powered-by {
// Some Styles
}
hook_preprocess_block()
.block {
// Some Styles
}
.block--primary {
// Some Styles
}
.block--minimal {
// Some Styles
}
hook_preprocess_block()
/**
* Implements hook_preprocess_TEMPLATE().
*/
function hook_preprocess_block(&$variables) {
$block = $variables['block'];
$name = $block->module . '_' . $block->delta;
switch ($name) {
case 'system_navigation':
$variables['attributes_array']['class'][] = 'block--primary';
break;
case 'search_form':
case 'system_powered-by':
$variables['attributes_array']['class'][] = 'block--minimal';
break;
}
}
omega-wizard
$ drush omega-wizard
Please enter the name of the new sub-theme [Omega Subtheme]: Test Theme
Please enter a machine-readable name for your new theme [test_theme]: custom
Please choose a base theme for your new theme
[0] : Cancel
[1] : Omega
Please choose a starterkit for your new theme
[0] : Cancel
[1] : Default (Provided by Omega)
[2] : Extended (Provided by Omega)
Please choose a destination. This is where your sub-theme will be placed
Please choose a destination type.
[0] : Cancel
[1] : Site (e.g. 'all' or 'example.com')
[2] : Installation profile
[3] : Parent theme
omega-wizard
Please choose a site.
[0] : Cancel
[1] : all
Do you want to keep the starterkit`s readme files? (y/n): n
Do you want to enable your new theme? (y/n): y
Do you want to make your new theme the default theme? (y/n): y
You have successfully created the theme Test Theme (custom) in sites/all/themes.
omega-export & omega-revert
drush omega-export
Which theme do you want to export the theme settings for?
[0] : Cancel
[1] : Test Theme (Subtheme of Omega)
[2] : Omega
The theme settings for the Ohm theme have been exported to the .info file.
drush omega-revert
Which theme do you want to revert the theme settings for?
[0] : Cancel
[1] : Test Theme (Subtheme of Omega)
[2] : Omega
The theme settings for the Ohm theme have been reverted.
bower.json
filebower.json
file