示例#1
0
 public function files_for_stylesheet_link_tag()
 {
     $css_urls = array();
     if ($css_files = $this->get_files_from_manifest(Trax::$assets_path . "/stylesheets/application.css")) {
         self::reset_assets_dir("stylesheets");
         $compiled_css = array();
         foreach ($css_files as $file) {
             if ($this->compress()) {
                 # write files to disk compressed
                 $compiler = new Compiler($file);
                 $compiled_css[$file] = $compiler->process_file();
             } else {
                 # copy to assets folder
                 $css_parts = explode("/assets/stylesheets/", $file);
                 $css_urls[] = $this->public_url($css_parts[1]);
                 $this->copy_file($file);
             }
         }
         if ($this->compress()) {
             $fingerprint = self::fingerprint($css_files);
             $filename = "application-{$fingerprint}.css";
             if ($this->write_file($filename, implode("\n", $compiled_css))) {
                 $css_urls = array($this->public_url($filename));
             }
         }
     }
     #print_r($css_urls);
     return $css_urls;
 }