.htaccess - PyroCMS - Assets class doesn't minify and combine -
i have problem assets class minify , combine css , js. have plugin ad seems work without problem:
class plugin_theme_assets extends plugin { /** * combine , insert multiple js files * * usage: * { theme_assets:js_files files="file1.js,file2.js" } */ function js_files() { $files = $this->attribute('files'); preg_match_all('/[\w-\.]+\.js/i', $files, $files_a); foreach($files_a[0] $file) { asset::js($file); } return asset::render_js(); } /** * combine , insert multiple css files * * usage: * { theme_assets:css_files files="file1.css,file2.css" } */ function css_files() { $files = $this->attribute('files'); preg_match_all('/[\w-\.]+\.css/i', $files, $files_a); foreach($files_a[0] $file) { asset::css($file); } return asset::render_css(); } } this .htaccess file , can si have uncomment setenv:
# multiple environment config # set development, staging or production setenv pyro_env production <ifmodule mod_rewrite.c> # make sure directory listing disabled options +followsymlinks -indexes rewriteengine on # notice: if 404 play combinations of following commented out lines #allowoverride rewritebase / # restrict site 1 domain # !important use 1 option # option 1: rewrite "www.domain.com -> domain.com" uncomment following lines. rewritecond %{https} !=on rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] # option 2: rewrite "domain.com -> www.domain.com" uncomment following lines. #rewritecond %{https} !=on #rewritecond %{http_host} !^www\..+$ [nc] #rewritecond %{http_host} (.+)$ [nc] #rewriterule ^(.*)$ http://www.%1/$1 [r=301,l] # remove index.php url #rewritecond %{http:x-requested-with} !^xmlhttprequest$ #rewritecond %{the_request} ^[^/]*/index\.php [nc] #rewriterule ^index\.php(.*)$ $1 [r=301,ns,l] # keep people out of codeigniter directory , git/mercurial data redirectmatch 403 ^/(system\/cms\/cache|system\/codeigniter|\.git|\.hg).*$ # send request via index.php (again, not if real file or folder) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d <ifmodule mod_php5.c> rewriterule ^(.*)$ index.php/$1 [l] </ifmodule> <ifmodule !mod_php5.c> rewriterule ^(.*)$ index.php?/$1 [l] </ifmodule> </ifmodule> so, if i'm right pyro_env "production".
if refresh page css , js file not minify , combine single file... here plugin return
<link href="http://example:8888/addons/default/themes/mytheme/css/nivo-slider.css" rel="stylesheet" type="text/css" /> <link href="http://example:8888/addons/default/themes/mytheme/css/default.css" rel="stylesheet" type="text/css" /> can please me?
if hosting not allow setenv in .htaccess, can use rewrite rules send environment variable:
rewritecond %{http_host} ^local.yoursite.com$ rewriterule (.*) $1 [e=pyro_env:development] rewritecond %{http_host} ^beta.yoursite.com$ rewriterule (.*) $1 [e=pyro_env:staging] rewritecond %{http_host} ^yoursite.com$ rewriterule (.*) $1 [e=pyro_env:production] the asset minification , combine occur default on production or staging system, development environments won't minify , combine development/debugging purposes. can override in system/cms/config/asset.php testing purposes.
Comments
Post a Comment