Note that there are some explanatory texts on larger screens.

plurals
  1. POMaking the speed of SASS as fast as the CSS in Sinatra
    primarykey
    data
    text
    <p>Hi, let's look the code first.</p> <p>I use the slim as the view template in Sinatra.</p> <p><strong>Snippet 1</strong> : template file, index.slim</p> <pre><code>doctype html html head title = @title link rel='stylesheet' type='text/css' href='css/origin.css' link rel='stylesheet' type='text/css' href='css/sass.css' body div This is a test for SASS </code></pre> <p><strong>Snippet 2</strong> : control file, route.rb that is a sinatra app file </p> <pre><code>require "sass" configure do set :sass, :cache =&gt; true, :cache_location =&gt; './tmp/sass-cache', :style =&gt; :compressed end get '/' do @title = 'default page' slim :index end get '/css/sass.css' do sass :index end </code></pre> <p><strong>Snippet 3</strong> : style file</p> <p>index.sass in my views folder that is a template path</p> <pre><code>div color: white background: green </code></pre> <p>origin.css in <code>/public/css/orgin.css</code> that is default style path</p> <pre><code>div {padding: 10px;margin: 10px;} </code></pre> <p><strong>Snippet 4 :</strong> This is the log of server that shows the speed of orgin css file and sass file</p> <pre><code>[coolesting@localhost ds]$ rackup [2011-11-23 00:02:36] INFO WEBrick 1.3.1 [2011-11-23 00:02:36] INFO ruby 1.9.2 (2011-07-09) [i686-linux] [2011-11-23 00:02:36] INFO WEBrick::HTTPServer#start: pid=5285 port=9292 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET / HTTP/1.1" 200 283 0.0261 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET /css/origin.css HTTP/1.1" 304 - 0.0005 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET /css/sass.css HTTP/1.1" 200 64 0.0060 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET / HTTP/1.1" 200 283 0.0029 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET /css/origin.css HTTP/1.1" 304 - 0.0005 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET /css/sass.css HTTP/1.1" 200 64 0.0029 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET / HTTP/1.1" 200 283 0.0190 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET /css/origin.css HTTP/1.1" 304 - 0.0005 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET /css/sass.css HTTP/1.1" 200 64 0.0043 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET / HTTP/1.1" 200 283 0.0029 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET /css/origin.css HTTP/1.1" 304 - 0.0005 127.0.0.1 - - [23/Nov/2011 00:02:38] "GET /css/sass.css HTTP/1.1" 200 64 0.0012 127.0.0.1 - - [23/Nov/2011 00:02:39] "GET / HTTP/1.1" 200 283 0.0056 127.0.0.1 - - [23/Nov/2011 00:02:39] "GET /css/sass.css HTTP/1.1" 200 64 0.0016 127.0.0.1 - - [23/Nov/2011 00:02:39] "GET /css/origin.css HTTP/1.1" 304 - 0.0187 127.0.0.1 - - [23/Nov/2011 00:02:39] "GET / HTTP/1.1" 200 283 0.0028 127.0.0.1 - - [23/Nov/2011 00:02:39] "GET /css/origin.css HTTP/1.1" 304 - 0.0005 127.0.0.1 - - [23/Nov/2011 00:02:39] "GET /css/sass.css HTTP/1.1" 200 64 0.0011 </code></pre> <p>So, how to make the sass file running as fast as the origin css file, i have enabled the cache, but it slow than the origin css.</p> <p>Or what solution to let the web server directly read the css file that is rendered from sass file.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload