Drupal 7: Put the path to the theme in Drupal.settings for use in javascript files.
yepnope({
test: Modernizr.touch,
yep: '/' + Drupal.settings.pathToTheme + '/js/hammer.js'
});
<?php
function mytheme_preprocess_page(&$vars) {
// Add the path to this theme to Drupal.settings
$setting['pathToTheme'] = path_to_theme();
drupal_add_js($setting, 'setting');
}
// OR:
function mytheme_preprocess_page(&$vars) {
// Add the path to this theme to Drupal.settings
drupal_add_js('jQuery.extend(Drupal.settings, { "pathToTheme": "' . path_to_theme() . '" });', 'inline');
}