I'm going to make a single page website.
I know it's little tricky if I use Drupal to build it. I was considering using a module named [Single Page Website](Single Page Website), however it seems it has many dependency and it's not developing currently.
According to a committer of Single Page Site, he has an experience using "Single Page Website", and I thought why he is building "Single Page Site" is he wasn't satisfied with it with some reason. So I decide using "Single Page Site."
Actually it's my first time using Drupal, so let's see what's going on.
- OS X Yosemite 10.10.3
- MAMP
- Drupal 7.37
- Install a theme: Zen
- Make a sub-theme based on Zen. Thankfully Zen has good documentations.
- Install modules: Single Page Site(7.x-1.1+10-dev), and Menu attributes(7.x-1.0-rc3+1-dev)
- Make those modules enable in Home > Administration > Modules
- Set configurations in Home > Administration > System > Single Page Site Settings
- Menu should be "Main menu".
- Fill in Menu item selector.
- Turn on "Homepage" checkbox.
- Add a basic page.
- Select Menu settings
- Turn on "Provide a menu link" checkbox.
- Set Menu link title.
- Set Name in MENU LINK ATTRIBUTES. You can leave it as blank. If you set here it will be a section title.
- Set Classes in MENU LINK ATTRIBUTES. This must be the same name as you set in 5.2.
- Select URL path settings.
- Set URL alias, and save it.
In my structure, I have only one block "main page content" in Content region.
In order to start styling, I got a useful style guide, SMACSS.
This is my list for styling tools.
- Sass
- SMACSS
- Compass
- Firefox(w/ Firebug, FireCompass)
I'm going to follow the link below. Getting started with Drupal7, Zen, Sass and Compass
- Install Ruby, Sass, and Compass.
- Open the project(sub-theme's directory) by an editor whichever you like. I'm using Vim and Sublime Text 2
- In sub-theme directory, command "compass watch .", it let you watch sub-theme directory.
- Create a new .scss file and import it in styles.scss. Edit the new scss file.
Also, I want to change html structure. It means I need to change php files.
- Copy .tpl.php file(s) which you want to change from original theme's templates directory to sub-theme's templates directory.
- Change the php code.
- In Drupal, Home > Administration > Configuration > Development > Performance, click a "Clear all caches" button.
- Now you can see where you've changed.
I am a big fun of Bootstrap. Even though the code is little bigger, the document and component itself are more than that. I usually import it through CDN.
Example of implementing CDN URLs into Drupal
//CSS
drupal_add_css('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css', array('type' => 'external'));
drupal_add_css('https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array('type' => 'external'));
//JS
drupal_add_js('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js', 'external');
-
Since I am going to add html code, and also upload images into the content area, I installed Wysiwyg. The installation how I did is just follow the video I referred. Drupal Tutorials #19 - Installing a Wysiwyg aka a Text Editor - by LevelUpTuts
-
I want to have an opt-in form on my website. I installed Webform. Check the video here. Drupal Tutorials #21 - Webform - A Better Contact Form Module - by LevelUpTuts
-
Apparently version of jQuery is little old. Install jQuery Update.
-
I am going to use modal window. I could write code for it, but this time I want to use existed modules as much as possible. It seems good using Colorbox Node