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

Cannot specify SASS compression style #153

Open
calvinwyoung opened this issue Jan 22, 2014 · 2 comments
Open

Cannot specify SASS compression style #153

calvinwyoung opened this issue Jan 22, 2014 · 2 comments

Comments

@calvinwyoung
Copy link

I'm working on a project with Sinatra + Sinatra-Assetpack, but the I can't seem to specify the SASS compression style. I've added css_compression :sass, :style => :compressed to the end of my assets configuration block, but the outputted CSS is not compressed. Setting any other value for the :style option doesn't work either.

I've already seen this StackOverflow post, but it wasn't helpful. I also couldn't find any information anywhere else.

I've made a sample projects with the following files:

  • app.rb
  • views/index.erb
  • assets/css/styles.scss

Here are the contents of each file.

app.rb:

require "rubygems"
require "sass"
require "sinatra"
require "sinatra/assetpack"

assets do
  serve "/css", :from => "assets/css"

  css :application, [
    "/css/styles.css"
  ]

  css_compression :sass, :style => :compressed
end

get "/" do
  erb :index
end

index.erb:

<!DOCTYPE html>
<html lang="en">
    <head>
        <%= css :application %>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>

styles.scss:

body {
    background: red;
    h1 {
        font-weight: bold;
    }
}

The outputted styles.css file looks like this:

body {
  background: red; }
  body h1 {
    font-weight: bold; }

This output corresponds to the default :nested output style, not the :compressed output style.

Setting the compression type to :styles => :expanded produces the same result, as does removing the option altogether.

Has anyone else experienced a similar issue? If so, how did you resolve it?

@j15e
Copy link
Collaborator

j15e commented Jan 22, 2014

Default style should be compress :

https://github.com/rstacruz/sinatra-assetpack/blob/master/lib/sinatra/assetpack/engines/sass.rb#L4

But also it seems like @css_compression_options isn't used at all from a quick code survey.

@calvinwyoung
Copy link
Author

Hmm...it does seem as though the default should be :compresed. Why on earth is it actually producing :nested output?

For reference, here are the relevant packages / versions from my bundle:

  • sass (3.2.13)
  • sinatra (1.4.4)
  • sinatra-assetpack (0.3.2)
  • tilt (1.4.1)

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