rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 97 forks source link

Don't generate assets for SASS partials #130

Open zdennis opened 10 years ago

zdennis commented 10 years ago

All of our SCSS/SASS partial are having assets generated for them. They all are created with the following body:

<!DOCTYPE html>
<html>
<head>
  <style type="text/css">
  body { text-align:center;font-family:helvetica,arial;font-size:22px;
    color:#888;margin:20px}
  #c {margin:0 auto;width:500px;text-align:left}
  </style>
</head>
<body>
  <h2>Sinatra doesn&rsquo;t know this ditty.</h2>
  <img src='http://example.org/__sinatra__/404.png'>
  <div id="c">
    Try this:
    <pre># in Users/zdennis/source/my_project/my-appconfig/../lib/authentication_portal/app.rb
class AuthenticationPortal::App
  get '/stylesheets/grid/_fixed.css' do
    "Hello World"
  end
end
</pre>
  </div>
</body>
</html>

We don't load these files in production so it's just unnecessary cruft that gets asked about during code reviews. It would be great if these files weren't generated.

dongyuwei commented 9 years ago

The short answer is:

assets {
     ###other config
    clear_ignores!
}

why ? because in file assetpack/options.rb, there is an ignore '_*' function call. Then when call the add_individual_routes method, all sass partials just be ignored. So the build_get will send a http request for the partial file, which will result at a 404 error.