Example #1
0
                             $out[$key] = css_min(solve_paths($out[$key]));
                         } else {
                             if (!preg_match('/\\.(min|pack)\\.js$/', $test)) {
                                 $out[$key] = js_min($out[$key]);
                             }
                         }
                         status('prepare', "{$key}");
                     }
                 }
                 // final integration
                 if (!empty($out)) {
                     $set = array_keys($out);
                     write($tmp = path(TMP, md5($file)), join("\n", $out));
                     $hash = md5(md5_file($tmp) . filesize($tmp));
                     $name = str_replace($base_path . DIRECTORY_SEPARATOR, '', $file);
                     $min_file = path($static_dir, \IO\File::extn($name) . "{$hash}.{$type}");
                     if (s3_handle()) {
                         s3_upload_asset($tmp, str_replace($static_dir . DIRECTORY_SEPARATOR, '', $min_file));
                     } else {
                         is_dir(dirname($min_file)) or mkdir(dirname($min_file), 0777, TRUE);
                         rename($tmp, $min_file);
                     }
                     \Sauce\App\Assets::assign($path = str_replace(path($base_path, $type) . DIRECTORY_SEPARATOR, '', $file), $hash);
                     status('hashing', "{$path} [{$hash}]");
                 }
             }
         });
     }
 }
 status('update', 'config/resources.php');
 \Sauce\App\Assets::save();