Question

I have a basic Sinatra app and I am attempting to use AssetPack to serve my assets. I am currently only trying to serve css files from sass files. I am including the sass gem.

Snippit from my app.rb file:

register Sinatra::AssetPack

assets {
  css :application, '/css/application.css', [
    '/css/styles.sass'
  ]

  css_compression :sass
}

I am using slim so I have:

== css :application

For what ever reason, no css file is generated, only the sass file gets served.

Any help would be greatly appreciated!

No correct solution

OTHER TIPS

So make sure you are including <%= css :application %> in your layout file you want the CSS to load on.

You also want to make sure the gem is being loaded with gem 'sass' in your gemfile.

Also make sure your app root is set correctly in your main app file with set :root, File.dirname(__FILE__)

Another reason may be you are running Sinatra in DEVELOPMENT mode. Try setting your RACK_ENV to PRODUCTION, or set your development environment in rubymine to PRODUCTION.

Sinatra asset pack will not compress the file unless you run it through production, so that may be the main issue. I assume right now it serves up the SASS file with a cache buster appended to it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top