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 @import not reloaded #139

Closed
Awea opened this issue Oct 8, 2013 · 5 comments
Closed

Sass @import not reloaded #139

Awea opened this issue Oct 8, 2013 · 5 comments

Comments

@Awea
Copy link

Awea commented Oct 8, 2013

I'm using the following application.sass file :

@import "global/var"
@import "global/mixin"

@import "layout/bootstrap.css"
@import "layout/layout"

@import "dev/dev"
@import "dev/shame"

With the following configuration :

set :sass, { :load_paths => [ 
    "#{self.root}/public/stylesheets"
  ]}

  register Sinatra::AssetPack

  assets {
    serve '/javascripts', from: 'public/javascripts'
    serve '/stylesheets', from: 'public/stylesheets'
    serve '/images',      from: 'public/images'

    js :app, '/javascripts/app.js', [
      '/javascripts/libs/*.*'
    ]

    css :app, '/stylesheets/app.css', [
      '/stylesheets/application.css'
    ]

    js_compression  :jsmin
    css_compression :simple
  }

It work well. But when I change something in an included sass file, I need to save the application.sass too to get the changes.

@j15e
Copy link
Collaborator

j15e commented Oct 8, 2013

This bug is a feature of sass, not a bug of sinatra-assetpack. See #102 also.

@Awea
Copy link
Author

Awea commented Oct 8, 2013

May be it can be solve using some Sprockets stuff.
Or using an other gem like https://github.com/kalasjocke/sinatra-asset-pipeline.

@leebrooks0
Copy link

Here is how I solved the problem using Guard Shell (https://github.com/hawx/guard-shell). Note that it is important that your 'manifest' file is not watched, or you will end up in an infinite loop.

# Workaround for https://github.com/rstacruz/sinatra-assetpack/issues/139
# Note: As of writing this, Guard-Shell gem needs file permissions loosened:
# https://github.com/hawx/guard-shell/issues/14
guard :shell do
  watch (%r{^app/assets/stylesheets/(.*)/(.*)\.scss}) do |m|
    # Notify me that the file has changed
    puts m[0] + " has changed."

    manifest = "#{ Dir.pwd }/app/assets/stylesheets/application.scss"
    command = "touch #{ manifest }"
    puts command # Nice to see in the terminal, Guard is a developer tool after all...

    `#{ command }`
  end
end

@Awea
Copy link
Author

Awea commented Dec 15, 2013

@leebrooks0 Seems good ! This issue is not related to this gem but to our environment of development.
So I close it ^^

@Awea Awea closed this as completed Dec 15, 2013
@rolandjitsu
Copy link

@Awea 👍 Helpful solution, perhaps should be added to README.md.

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

4 participants