Git Product home page Git Product logo

sass-rails-source-maps's Introduction

DEPRECATED: Sass Rails Source Maps

This gem is not under active developement

As an alternative, you can try to use sassc-rails with inline source maps support.


NOTE: This gem requires sass-rails version 5.0.0

This gem allows you to see your Rails 4 .scss source files in Google Chrome inspector, which can be useful for debugging.

debug_info option available in stable sass gem is no longer working in Google Chrome, because Chrome now supports Source Map v3 only.

Installation

Source Maps are supported by sass gem in version 3.3 and higher. Unfortunately, sass-rails, the rails dependency, freezes sass gem to version ~> 3.2.0. To use this gem, you need to follow these steps:

  • Add sass-rails-source-maps to your application's Gemfile :
group :development do
  gem 'sass-rails-source-maps'
end

This branch depends on sass-rails version 5.0.0 which has more relaxed dependency for sass gem. So to avoid version conflict you need to:

  • Unfreeze sass-rails gem in your Gemfile (delete version for sass-rails)

For example, in new Rails 4.1.5 application change line

gem 'sass-rails', '~> 4.0.3'

to

gem 'sass-rails'

in your Gemfile.

  • And then execute:
bundle update sass-rails
  • After that, run:
rake assets:clobber

to make Rails regenerate assets. After assets regeneration, assets/source_maps containing sass source maps is created in public directory.

Usage

If everything works fine, you should see something like this screenshot

Enabling source maps may vary in different Chrome versions. For more info please see Working with CSS Preprocessors.

Notes

  • This gem is not intended for production usage.
  • This gem is Rails 4.x compatible only

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

sass-rails-source-maps's People

Contributors

aaronjensen avatar budnik avatar chadmoore avatar vhyza avatar yukihr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sass-rails-source-maps's Issues

Rails 4.0.13 not working

File to import not found or unreadable: application/*.

application.scss

@import "bourbon";
@import "reveal";
@import "az-misc";
@import "az-payments";
@import "application/vars";
@import "application/*";

Exception during precompile when using @import glob format provided by sass-rails

My SCSS files are rather voluminous and therefore I use the glob format provided by sass-rails to include all SCSS files within a directory. For instance, my application.sass file looks something like this:

/*
* sprockets imports...
*/

@import "custom/shared/*";
@import "custom/*";
@import "views/**/*";

However, it seems the glob format causes an exception in sass-rails-source-maps during precompile. Specifically, this seems to happen within the evaluate_with_source_maps wrapper method. What appears to be happening is that it's reading the filename as the literal "*" string, rather than processing the collection of filenames returned by sass-rails

This was on the beta branch for sass-rails. Specifically, the context of the stack trace was:

/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/visitors/perform.rb:157:in `visit'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/visitors/perform.rb:8:in `visit'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/root_node.rb:36:in `css_tree'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/tree/root_node.rb:29:in `render_with_sourcemap'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/engine.rb:368:in `_render_with_sourcemap'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sass-3.4.11/lib/sass/engine.rb:285:in `render_with_sourcemap'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/bundler/gems/sass-rails-source-maps-1328c96ef524/lib/sass-rails-source-maps/sass_template.rb:35:in `evaluate_with_source_maps'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/context.rb:197:in `block in evaluate'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `each'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/context.rb:194:in `evaluate'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/processed_asset.rb:12:in `initialize'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `new'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/base.rb:373:in `build_asset'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/Aerlinger/.rvm/gems/ruby-2.1.5/gems/sprockets-2.12.3/lib/sprockets/caching.rb:58:in `cache_asset'

Warning. Error encountered while saving cache , can't dump anonymous class

Hi vhyza

I'm running a boostrap extension in spree with your sass source maps enabled so I can look at the sass in Chrome Dev tools , but when rails starts up it gives the following messages when trying to create the maps using the spree_bootstrap_frontend .

Warning. Error encountered while saving cache 9a39fc98b4d0af3a5c48a5aac0b45b4255e9704e/spree_bootstrap_frontend.css.scssc: can't dump anonymous class #<Class:0x00000001a1c358>
Warning. Error encountered while saving cache 9589ce044d8a3302afcad295a7143c2ce4a2b5c9/bootstrap.scssc: can't dump anonymous class #<Class:0x00000001a1c358>
Warning. Error encountered while saving cache 53f6eed7e0144ecbd854ba9771a0da4067d95123/bootstrap.scssc: can't dump anonymous class #<Class:0x00000001a1c358>
Warning. Error encountered while saving cache 53f6eed7e0144ecbd854ba9771a0da4067d95123/_variables.scssc: can't dump anonymous class #<Class:0x00000001a1c358>
Warning. Error encountered while saving cache 53f6eed7e0144ecbd854ba9771a0da4067d95123/_mixins.scssc: can't dump anonymous class #<Class:0x00000001a1c358>
Warning. Error encountered while saving cache 53f6eed7e0144ecbd854ba9771a0da4067d95123/_normalize.scssc: can't dump anonymous class #<Class:0x00000001a1c358>
Warning. Error encountered while saving cache 53f6eed7e0144ecbd854ba9771a0da4067d95123/_print.scssc: can't dump anonymous class #<Class:0x00000001a1c358>

and so on

My Gemfile

source 'https://rubygems.org'
gem 'rails', '4.0.1'
gem 'sqlite3'

gem 'sass-rails', github: "rails/sass-rails"
gem 'sass', git: 'https://github.com/nex3/sass.git'

gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
  gem 'sdoc', require: false
end

group :development do
   gem 'coffee-rails-source-maps'
   gem 'sass-rails-source-maps'
end

gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-1-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-1-stable'
gem 'spree', '2.1.4'
gem 'spree_bootstrap_frontend', github: '200Creative/spree_bootstrap_frontend', branch: '2-1-stable'

I've looked around for the "Error encountered while saving cache " message and found the following
middleman/middleman#716 but that just recommend changing to a older version of sass , which I tried but cannot do as source-maps is locked

Bundler could not find compatible versions for gem "sass":
  In Gemfile:
    sass-rails-source-maps (>= 0) ruby depends on
      sass (>= 3.3.0.rc.2) ruby

    sass (3.2.14)

I should let you know that I have got it working on blank project and that spree_bootstrap_frontend gem is giving me the errors. I posted on that project with the a similar question , as I'm not sure if its sass , sass-rails-source-maps or the spree-bootstrap_frontend is giving the issue.

Any pointers/help much appreciated.

Andy

ArgumentError - wrong number of arguments (2 for 1)

Hey, I'm trying to use sass-rails-source-maps on a new Rails 4.1 project, but with no luck.

I added gem "sass-rails-source-maps" to my Gemfile as described in the README, deleted the assets folders and restarted the development server. When I load a page, I get the following error:

ArgumentError - wrong number of arguments (2 for 1)
  (in /Users/gabriele/path/to/rails/application/app/assets/stylesheets/application.css.scss)

Full stack trace here.

You can also have a look at my SCSS here, although I'm not sure it'd be relevant.


My Gemfile contains the bootstrap-sass, bourbon and sass-rails gems. Are any of those known to cause conflicts?

When I first added sass-rails-source-maps to my Gemfile, running bundle gave me the following error:

$ bundle
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "sass":
  In Gemfile:
    sass-rails-source-maps (>= 0) ruby depends on
      sass (>= 3.3.0.alpha.88) ruby

    bootstrap-sass (~> 3.1.0.2) ruby depends on
      sass (3.2.14)

After googling this, I solved it by deleting my Gemfile.lock and running bundle again. It completed successfully but I would now get the error described above.

Here are my full Gemfile and Gemfile.lock.

I am using Rails 4.1.0.beta1, Ruby 2.1.0p0.

Thanks in advance for your help!

The gem has no effect

I tried adding source maps to my project, but to no avail.

I'm running:

  • sass-rails-source-maps (0.0.4)
  • sass (>= 3.3.0.rc.3)
  • sass-rails (4.0.1)

I took the following steps:

  • Added the gem
  • Ran bundle
  • Ran bundle update sass
  • Stopped the server (including spring)
  • Removed the cache (rm -rf tmp/cache)
  • Restarted the server

When I open one of the pages in my browser, all the css is still labelled as application.css.

The CSS contains lines like

/* line 173, /.../app/assets/stylesheets/components/my_stylesheet.css.scss */

but I think those were there before adding the gem.

Bundler could not find compatible versions for gem "sass"

I'm getting this when trying to install:

Bundler could not find compatible versions for gem "sass":
  In Gemfile:
    sass-rails-source-maps (>= 0) ruby depends on
      sass (>= 3.3.0.alpha.88) ruby

    compass-rails (~> 2.0.alpha.0) ruby depends on
      sass (3.2.12)

Any way to solve this?

Update README.markdown

The current readme + screenshots are way out of date, as the CSS sourcemaps have been out of experiment for quite a while.

sass dependency not compatible with sass-rails

sass-rails latest stable requires sass ~> 3.2.0, but you're requiring >= 3.3.0.rc.3

Bundler could not find compatible versions for gem "sass":
  In Gemfile:
    sass-rails (~> 4.0.3) ruby depends on
      sass (~> 3.2.0) ruby

    sass-rails-source-maps (>= 0) ruby depends on
      sass (3.4.1)

Use with sass-rails?

Is this supposed to be used along with sass-rails?

Bundler could not find compatible versions for gem "sass":
  In Gemfile:
    sass-rails (~> 4.0.3) ruby depends on
      sass (~> 3.2.0) ruby

    sass-rails-source-maps (>= 0) ruby depends on
      sass (3.3.4)

edit:always have this conflict. thought i had fixed it...

NameError: uninitialized constant Sprockets::SassImporter

$ rake assets:clobber
rake aborted!
NameError: uninitialized constant Sprockets::SassImporter
/Users/mark/.rvm/gems/ruby-2.1.2/gems/sass-rails-source-maps-0.1.0/lib/sass-rails-source-maps/sass_importer.rb:2:in `<module:SassRailsSourceMaps>'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/sass-rails-source-maps-0.1.0/lib/sass-rails-source-maps/sass_importer.rb:1:in `<top (required)>'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/sass-rails-source-maps-0.1.0/lib/sass-rails-source-maps.rb:5:in `<top (required)>'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
/Users/mark/.rvm/gems/ruby-2.1.2/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'

Rails 4.2.3
Using Sass Rails 5.0.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.