Extension, Plugin

Archived
Forum
(read-only)

Minimee

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From John D. Wells

     

“Not allowed to load local resource” error in console when css used in minimee

Bug Report

PaleoSun
PaleoSun

So, in my site header, I’m loading a bunch of CSS files, and Minimee is doing a great job of keeping them all neat and tidy and together and small. However, I just started adding jQuery UI to my site, and ran into an issue that seems to be Minimee related.

So, if I try to include the css file within my minimee tags, I see lots of errors in my chrome console, like:

Not allowed to load local resourcefile:///C:/workspace/BlueRidgeMusicTrails/css/themes/redmond/minified/images/ui-bg_inset-hard_100_fcfdfd_1x100.png 

But if I just include the CSS in the normal way, without involving MiniMee, it does not throw those errors. That image file is indeed in the location is should be.

So, this code throws that console error:

{exp:minimee:css queue="head_css"}
  
<link rel="stylesheet" href="/css/themes/redmond/minified/jquery-ui.min.css" />
 
{/exp:minimee:css} 

but if I just include the CSS without Minimee (even if I am still using minimee for other stuff) it works:

<link rel="stylesheet" href="/css/themes/redmond/minified/jquery-ui.min.css" /> 

Anyone else have this error? Any suggestions?

PaleoSun
# 1
PaleoSun

Ok, I just did a test, on another CSS file. It seems like this will throw the error:

body{
 background
-imageurl(user-content/image.png);

but this wont:

body{
 background
-imageurl(/user-content/image.png);

The only difference is the backslash at the beginning of the file path. So relative paths are a no-no?

John D Wells
# 2
Developer
John D Wells

Hi PaleoSun,

When Minimee combines & compresses all of your CSS files, it needs to re-write all of the paths to your assets so that when the cache is saved elsewhere on your site, it is still able to properly link to everything. But, it is usually pretty good at re-writing these regardless of whether your paths are relative or absolute.  In fact I always use relative paths.

How are you configuring Minimee?  It is possible to override this re-write setting, perhaps there is something amiss in your config.

Cheers,
John

PaleoSun
# 3
PaleoSun

Hiya John,
  Thanks for your fast reply. Here is my current config. I’ve got this in my EE config file:

// Minimee Config - http://johndwells.github.com/Minimee/
$config['minimee'= array(
 
'cache_path'  => 'cssjs-cache',
 
'cache_url'   => $base_url.'/cssjs-cache',
 
'combine_css'  => 'yes',
 
'combine_js'  => 'yes',
 
'minify_css'  => 'yes',
 
'minify_html'  => 'no',
 
'minify_js'   => 'yes',
 
'disable'   => 'no',
 
'cachebust'   => '',
 
'cleanup'   => 'yes',
 
'css_library'  => 'minify',
 
'css_prepend_mode' => 'yes',
 
'css_prepend_url' => $base_path,
 
'hash_method'  => 'sha1',
 
'js_library'  => 'jsmin',
 
'remote_mode'  => 'auto'
); 
John D Wells
# 4
Developer
John D Wells

Hi PaleoSun,

Ah - you’ve set css_prepend_url to $base_path, but it requires a URL, so $base_url probably would work.

However in general I’d suggest reducing that config array down to the only 2 required elements, cache_path and cache_url.  This way you can let Minimee work with the defaults, which for 99% of circumstances is just fine.

Let me know if that works for you!

Cheers,
John

PaleoSun
# 5
PaleoSun

Thanks, John! That worked like a charm.

I appreciate your help! And I really appreciate your add-on!

John D Wells
# 6
Developer
John D Wells

Excellent, glad that’s worked for you. I’m pleased you’re happy with Minimee, thanks!

Cheers,
John