Proof of concept module for component based / style guide driven / atomic design Drupal theming.
- Drupal 7
- Developed for and tested with Omega 4 theme.
- Download and enable this module.
- Download Omega 4 theme.
- Create a Omega subtheme and set it as default theme.
- Create folder called
partials
in your Omega subtheme folder. - Add a file called
test.inc
inside thepartials
folder with this content:<h1 class="hello">Hello <?php print $user->name;?>!</h1>
- Go to
[site-url]/parts/test
to see the rendered partial. - Create a file
sass/components/_hello.scss
in your theme with this content:.hello { color: red; }
- Compile sass!
- Go to
[site-url]/parts/test
to see the rendered partial. - Copy the
page.tpl.php
file from the Omega theme's templates folder to your sub themes templates folder. - Add this line to someplace in the
page.tpl.php
file:<?php include template_partials_partial('test'); ?>
- Go to some page on your site and see the rendered result.
This is just a one step towards style guide driven / atomic design workflow on Drupal. Maybe you find it interesting and want to take it forward. The code is ugly and ad hoc at the moment. If you have any ideas or pull requests I would be happy to hear from you!