Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SASS is being served uncompiled and uncompressed: #135

Open
arman-h opened this issue Aug 17, 2013 · 1 comment
Open

SASS is being served uncompiled and uncompressed: #135

arman-h opened this issue Aug 17, 2013 · 1 comment

Comments

@arman-h
Copy link

arman-h commented Aug 17, 2013

sinatra-assetpack is serving SASS in plain-text format, with no conversion or compression. I have arranged the assets differently than shown in the examples:

./app.rb
./config.ru
./Gemfile
./Gemfile.lock
./assets
./assets/css
./assets/css/style.sass
./assets/img
./assets/js
./assets/js/app.js

but I have also made changes to reflect the correct asset structure in app.rb:

class MyApp < Sinatra::Base
    enable :inline_templates
    register Sinatra::AssetPack
    assets do
        serve '/js', :from => 'assets/js'
        serve '/css', :from => 'assets/css'

        js :app, [
            '/js/app.js'
        ]

        css :app, [
            '/css/style.sass',
        ]

        js_compression :jsmin
        css_compression :sass
    end

    get '/' do
        haml :index
    end

end

__END__

@@ layout
!!!
%html{:lang => "en"}
    %head
        != css :app
    %body
        = yield
        != js :app

@@ index
%h1 Hello World!

And here's the output:

<!DOCTYPE html>
<html lang='en'>
  <head>
    <link rel='stylesheet' href='/css/style.sass' />
  </head>
  <body>
    <h1>Hello World!</h1>
    <script src='/js/app.74be16979710d4c4e7c6647856088456.js'></script>
  </body>
</html>

I'm using Ruby 1.9.3, and my Gemfile / Gemfile.lock files look like this:

# Gemfile
source 'https://rubygems.org'
gem 'sinatra'
gem 'thin'
gem 'haml'
gem 'sass'
gem 'sinatra-assetpack', :require => 'sinatra/assetpack'


# Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:
    daemons (1.1.9)
    eventmachine (1.0.3)
    haml (4.0.3)
      tilt
    jsmin (1.0.1)
    rack (1.5.2)
    rack-protection (1.5.0)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    sass (3.2.10)
    sinatra (1.4.3)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (~> 1.3, >= 1.3.4)
    sinatra-assetpack (0.3.1)
      jsmin
      rack-test
      sinatra
      tilt (>= 1.3.0)
    thin (1.5.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    tilt (1.4.1)

PLATFORMS
  ruby

DEPENDENCIES
  haml
  sass
  sinatra
  sinatra-assetpack
  thin
@eka
Copy link

eka commented Oct 1, 2013

Did you solve this?

I think you should change this:

css :app, [
            '/css/style.css',
        ]

and the style.sass will be converted automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants