Skip to content

Commit

Permalink
Add files & folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Leiva committed Jul 7, 2014
1 parent acfc82b commit 2552ecb
Show file tree
Hide file tree
Showing 8 changed files with 381 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"browser": true,
"bitwise": true,
"devel": true,
"curly": true,
"eqeqeq": true,
"forin": true,
"immed": true,
"indent": 2,
"jquery": true,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": true,
"regexp": true,
"undef": true,
"unused": false,
"strict": false,
"trailing": true,
"smarttabs": true,
"predef": [
"Drupal",
"Modernizr"
]
}
105 changes: 105 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
'use strict';
// Configuring Grunt tasks:
// http://gruntjs.com/configuring-tasks
module.exports = function (grunt) {
// load all grunt tasks matching the `grunt-*` pattern
// https://github.com/sindresorhus/load-grunt-tasks
require('load-grunt-tasks')(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Watch for changes and trigger compass, jshint & uglify
watch: {
compass: {
files: ['sass/{,**/}*.scss'],
tasks: ['compass:dev']
},
js: {
files: '<%= jshint.all %>',
tasks: ['jshint', 'uglify:dev']
}
},

// Compass and scss
compass: {
options: {
config: 'config.rb'
},
dev: {
options: {
environment: 'development',
outputStyle: 'expanded',
relativeAssets: true
}
},
prod: {
options: {
environment: 'production',
outputStyle: 'compact',
force: true
}
}
},

// Javascript linting with jshint
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'js/sonambulo.js'
]
},

// Concat & minify
uglify: {
dev: {
options: {
mangle: false,
compress: false,
preserveComments: 'all',
beautify: true
},
files: {
'js/sonambulo.min.js': ['js/sonambulo.js']
// Output: input
}
},
prod: {
options: {
mangle: true,
compress: true
},
files: {
'js/sonambulo.min.js': ['js/sonambulo.js']
}
}
}
});

// Load the plugin(s), but I'm using load-grunt-tasks
// https://github.com/sindresorhus/load-grunt-tasks
// grunt.loadNpmTasks('grunt-concurrent');


// Where we tell Grunt what to do when we type "grunt" into the terminal.
// The "default" task is what I leave running all the time. Since it is the default,
// you can start it by simply running
// $ grunt
// or, to run production's tasks
// $ grunt build

grunt.registerTask('build', [
'jshint',
'uglify:prod',
'compass:prod'
]);

grunt.registerTask('default', [
'jshint',
'uglify:dev',
'compass:dev',
'watch'
]);
};
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ grunt-kickoff
=============

A set of starter files for a Grunt project, within a Drupal Theme.

31 changes: 31 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Require any additional compass plugins here.
require 'breakpoint'

# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
javascripts_dir = "js"

# Set the images directory relative to your http_path or change
# the location of the images themselves using http_images_path:
http_images_dir = "img"

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed

# To enable relative paths to assets via compass helper functions. Uncomment:
relative_assets = true


# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false


# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Sonambulo",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-compass": "~0.9.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jshint": "~0.10.0",
"jshint-stylish": "~0.2.0",
"grunt-contrib-uglify": "~0.5.0",
"load-grunt-tasks": "~0.6.0",
"grunt-notify": "~0.3.0"
}
}
49 changes: 49 additions & 0 deletions sonambulo.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name = Sonambulo
description = Base theme, naked markup & CSS
screenshot = screenshot.png
version = 0.1
engine = phptemplate
core = 7.x

;-------------- F E A T U R E S -------------
features[] = logo
features[] = favicon
features[] = name
features[] = slogan
features[] = node_user_picture
features[] = comment_user_picture
features[] = comment_user_verification
features[] = main_menu
features[] = secondary_menu

;-------------- R E G I O N S -------------
;regions_hidden[] = im_a_hidden_but_visibel_for_a_module

regions[page_top] = Page Top
regions[page_bottom] = Page Bottom

regions[utility_bar] = Utility Bar
regions[header] = Header
regions[navigation] = Navigation

regions[help] = Help
regions[highlighted] = Highlighted

regions[above_content] = Above Content
regions[content_aside] = Content Aside
regions[content] = Content
regions[sidebar_first] = Sidebar First
regions[sidebar_second] = Sidebar Second
regions[below_content] = Below Content

regions[footer] = Footer
regions[closure] = Closure

;-------------- C S S -------------
stylesheets[all][] = css/screen.css

;-------------- J S -------------
scripts[] = js/sonambulo.min.js



129 changes: 129 additions & 0 deletions template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?php
/**
* @file
* HTML template functions.
*/

/**
* Implements hook_preprocess_html().
* Meta tags https://drupal.org/node/1468582#comment-5698732
*/
function sonambulo_preprocess_html(&$variables) {
$meta_charset = array(
'#tag' => 'meta',
'#attributes' => array(
'charset' => 'utf-8',
),
);
drupal_add_html_head($meta_charset, 'meta_charset');

$meta_x_ua_compatible = array(
'#tag' => 'meta',
'#attributes' => array(
'http-equiv' => 'x-ua-compatible',
'content' => 'ie=edge, chrome=1',
),
);
drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible');

$meta_mobile_optimized = array(
'#tag' => 'meta',
'#attributes' => array(
'name' => 'MobileOptimized',
'content' => 'width',
),
);
drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized');

$meta_handheld_friendly = array(
'#tag' => 'meta',
'#attributes' => array(
'name' => 'HandheldFriendly',
'content' => 'true',
),
);
drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly');

$meta_viewport = array(
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1',
),
);
drupal_add_html_head($meta_viewport, 'meta_viewport');

$meta_cleartype = array(
'#tag' => 'meta',
'#attributes' => array(
'http-equiv' => 'cleartype',
'content' => 'on',
),
);
drupal_add_html_head($meta_cleartype, 'meta_cleartype');

// Use html5shiv.
if (theme_get_setting('html5shim')) {
$element = array(
'element' => array(
'#tag' => 'script',
'#value' => '',
'#attributes' => array(
'type' => 'text/javascript',
'src' => file_create_url(drupal_get_path('theme', 'sonambulo') . '/js/html5shiv-printshiv.js'),
),
),
);
$html5shim = array(
'#type' => 'markup',
'#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n",
);
drupal_add_html_head($html5shim, 'sonambulo_html5shim');
}

// Use Respond.js.
if (theme_get_setting('respond_js')) {
drupal_add_js(drupal_get_path('theme', 'sonambulo') . '/js/respond.min.js', array('group' => JS_LIBRARY, 'weight' => -100));
}

// Use normalize.css
if (theme_get_setting('normalize_css')) {
drupal_add_css(drupal_get_path('theme', 'sonambulo') . '/css/normalize.css', array('group' => CSS_SYSTEM, 'weight' => -100));
}
}

/**
* Implements hook_html_head_alter().
*/
function sonambulo_html_head_alter(&$head_elements) {

// Remove system content type meta tag.
unset($head_elements['system_meta_content_type']);
}

/**
* Implements hook_page_alter().
* https://gist.github.com/jacine/1378246
*/
function sonambulo_page_alter(&$page) {
// Remove all the region wrappers.
foreach (element_children($page) as $key => $region) {
if (!empty($page[$region]['#theme_wrappers'])) {
$page[$region]['#theme_wrappers'] = array_diff($page[$region]['#theme_wrappers'], array('region'));
}
}
// Remove the wrapper from the main content block.
if (!empty($page['content']['system_main'])) {
$page['content']['system_main']['#theme_wrappers'] = array_diff($page['content']['system_main']['#theme_wrappers'], array('block'));
}
}

function sonambulo_preprocess_node(&$vars) {
// Add a striping class.
$vars['classes_array'][] = 'node-' . $vars['zebra'];
}

function sonambulo_preprocess_block(&$vars, $hook) {
// Add a striping class.
$vars['classes_array'][] = 'block-' . $vars['zebra'];
}
27 changes: 27 additions & 0 deletions theme-settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
function sonambulo_form_system_theme_settings_alter(&$form, &$form_state) {

$form['libraries'] = array(
'#type' => 'fieldset',
'#title' => t('Additional Libraries'),
);
$form['libraries']['html5shim'] = array(
'#type' => 'checkbox',
'#title' => t('html5 Shim'),
'#default_value' => theme_get_setting('html5shim'),
'#description' => t('Adds the html5 shim, a library that enables non-modern browsers to recognize HTML5 elements.')
);
$form['libraries']['respond_js'] = array(
'#type' => 'checkbox',
'#title' => t('Respond'),
'#default_value' => theme_get_setting('respond_js'),
'#description' => t('respond.js: A fast & lightweight polyfill for min/max-width CSS3 Media Queries (JavaScript library for IE 6-8, and more).')
);
$form['libraries']['normalize_css'] = array(
'#type' => 'checkbox',
'#title' => t('normalize.css'),
'#default_value' => theme_get_setting('normalize_css'),
'#description' => t('A modern, HTML5-ready alternative to CSS resets.')
);

}

0 comments on commit 2552ecb

Please sign in to comment.