Permalink
Browse files

Fix loading of development JavaScript and CSS files when ARSKI_DEBUG …

…is set to true.
  • Loading branch information...
1 parent 1e90f70 commit f5415db584c42ec8d6479ab22446c0757fbd6d7a @beastaugh committed Jul 3, 2011
Showing with 53 additions and 37 deletions.
  1. +36 −0 app/api/deprecated.php
  2. +6 −0 changelog.txt
  3. +1 −1 functions.php
  4. +8 −34 library/core.php
  5. +2 −2 library/helpers/template_helper.php
@@ -12,6 +12,42 @@
*/
/**
+ * If debug mode is enabled, use uncompressed (development mode) JavaScript.
+ *
+ * @since 2.7
+ * @deprecated 3.1.0
+ *
+ * @see TARSKI_DEBUG
+ * @uses _tarski_compressible_asset_path
+ *
+ * @param string $path
+ * @return string
+ */
+function tarski_js($path) {
+ _deprecated_function(__FUNCTION__, '3.1.0');
+
+ return tarski_asset_path($path);
+}
+
+/**
+ * If debug mode is enabled, use uncompressed (development mode) CSS.
+ *
+ * @since 2.7
+ * @deprecated 3.1.0
+ *
+ * @see TARSKI_DEBUG
+ * @uses _tarski_compressible_asset_path
+ *
+ * @param string $path
+ * @return string
+ */
+function tarski_css($path) {
+ _deprecated_function(__FUNCTION__, '3.1.0');
+
+ return tarski_asset_path($path);
+}
+
+/**
* Adds JavaScript to the Tarski Options page.
*
* @since 1.4
View
@@ -18,10 +18,16 @@
function `tarski_should_show_authors`
* Deprecated `tarski_count_authors` and `tarski_resave_show_authors`
functions
+ * Deprecated `tarski_css` and `tarski_js` functions
* Removed all functions deprecated before version 3.0
* Deprecated `tarski_inject_scripts` function
* Removed defunct admin page JavaScript
+#### Bug fixes
+
+ * Make development JavaScript and CSS files load when `TARSKI_DEBUG` is set
+ to `true`
+
### Version 3.0.5 [§](http://tarskitheme.com/2011/03/18/3-0-release/)
View
@@ -175,7 +175,7 @@
} else {
// JavaScript
wp_enqueue_script('tarski',
- get_template_directory_uri() . '/app/js/tarski.js',
+ tarski_asset_path('app/js/tarski.js'),
array('jquery'), theme_version());
wp_localize_script('tarski', 'objectL10n', array(
'expand' => __('Expand', 'tarski'),
View
@@ -35,36 +35,6 @@ function is_valid_tarski_style($name) {
}
/**
- * If debug mode is enabled, use uncompressed (development mode) JavaScript.
- *
- * @since 2.7
- *
- * @see TARSKI_DEBUG
- * @uses _tarski_compressible_asset_path
- *
- * @param string $path
- * @return string
- */
-function tarski_js($path) {
- return _tarski_compressible_asset_path('js', $path);
-}
-
-/**
- * If debug mode is enabled, use uncompressed (development mode) CSS.
- *
- * @since 2.7
- *
- * @see TARSKI_DEBUG
- * @uses _tarski_compressible_asset_path
- *
- * @param string $path
- * @return string
- */
-function tarski_css($path) {
- return _tarski_compressible_asset_path('css', $path);
-}
-
-/**
* If debug mode is enabled, use an uncompressed version of the file.
*
* @since 2.7
@@ -76,11 +46,15 @@ function tarski_css($path) {
* @param string $path
* @return string
*/
-function _tarski_compressible_asset_path($type, $path) {
- $dev = defined('TARSKI_DEBUG') && TARSKI_DEBUG === true ? '.dev' : '';
- $path = preg_replace("/\.${type}$/", '', $path);
+function tarski_asset_path($path) {
+ $matches = array();
+ preg_match("/\\.[A-Za-z\d]+\$/", $path, &$matches);
+ $ext = count($matches) > 0 ? $matches[0] : '';
+ $suffix = defined('TARSKI_DEBUG') && TARSKI_DEBUG === true ? '.dev' : '';
+ $root = get_template_directory_uri();
+ $path = preg_replace("/${ext}\$/", '', $path);
- return $path . $dev . ".${type}";
+ return $root . '/' . $path . $suffix . $ext;
}
/**
@@ -182,9 +182,9 @@ function tarski_meta() {
function tarski_stylesheets() {
$style_array = array(
'main' => array(
- 'url' => get_bloginfo('stylesheet_url')),
+ 'url' => tarski_asset_path('style.css')),
'print' => array(
- 'url' => get_template_directory_uri() . '/library/css/print.css',
+ 'url' => tarski_asset_path('library/css/print.css'),
'media' => 'print'));
if (get_tarski_option('style')) {

0 comments on commit f5415db

Please sign in to comment.