compass-rails-source-maps 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7573a34835ee2c7d100450eb7dcce5aaee70c38
4
- data.tar.gz: dfd02e4814d923f3a367355b5a6450f54668e485
3
+ metadata.gz: 871528f50b51c78866e4a770babe27ccd0148096
4
+ data.tar.gz: 12ae74c4c28ac34d0d54f3c15be5228de8dfebf5
5
5
  SHA512:
6
- metadata.gz: 04447275ea4b34877dcb7f9c6c365343414a3303eb81914504f0e85365002bd9ad5811abcb65b8606e98b42e66df9d1eef4a77fc0d68393cfd4ec4d436f6b91a
7
- data.tar.gz: 7cb61d48389dd044764fddc3d4c4a970e06f86dc07d074812fa7a7a5bfb7ad5d8740d940b1678e39118bb79481d847ddfecae6d4fa78bd640ad61c4fd2293f8d
6
+ metadata.gz: bb8fe643ef849e1a6451bd0b6cd7a6d072a895ab9db11eff2d155e481edc9c88f28172d3c8d27fea5cfc5c17edea79f0112ce6c4ce4409151faec7f18887e555
7
+ data.tar.gz: 153bd8bc44a890c2fabbb1a5d1a5af0180da8db2b6f491fc7884da349a2c1c7270ec629c17f59301d04a61d045392ebe731f5ffcb49dd8da9d89e1e546afd025
@@ -6,3 +6,6 @@ require 'compass-rails-source-maps/version'
6
6
  require 'compass-rails-source-maps/sass_importer'
7
7
  require 'compass-rails-source-maps/sass_template'
8
8
 
9
+ require 'compass/sprite_importer'
10
+ require 'compass-rails-source-maps/sprite_importer'
11
+
@@ -1,9 +1,10 @@
1
1
  module CompassRailsSourceMaps
2
- class SassImporter < Sprockets::SassImporter
2
+ class SassImporter < Sass::Rails::SassImporter
3
3
 
4
4
  def public_url(uri, sourcemap_directory = nil)
5
- "/#{Sprockets::SassTemplate::SOURCE_MAPS_DIRECTORY}/#{File.basename(uri)}"
5
+ "/#{Sass::Rails::SassTemplate::SOURCE_MAPS_DIRECTORY}/#{File.basename(uri)}"
6
6
  end
7
7
 
8
8
  end
9
9
  end
10
+
@@ -1,54 +1,55 @@
1
- module Sprockets
2
- class SassTemplate < Tilt::Template
3
- SOURCE_MAPS_DIRECTORY = "assets/source_maps"
1
+ Sass::Rails::SassTemplate.class_eval do
2
+ SOURCE_MAPS_DIRECTORY = "assets/source_maps"
4
3
 
5
- def write_output(text, destination)
6
- FileUtils.mkdir_p(::Rails.root.join("public", SOURCE_MAPS_DIRECTORY))
7
- File.open(destination, 'wb') { |file| file.write(text) }
8
- end
4
+ def write_output(text, destination)
5
+ FileUtils.mkdir_p(::Rails.root.join("public", SOURCE_MAPS_DIRECTORY))
6
+ File.open(destination, 'wb') { |file| file.write(text) }
7
+ end
9
8
 
10
- def copy_dependencies(files)
11
- files.each do |file|
12
- FileUtils.cp(file, ::Rails.root.join("public", SOURCE_MAPS_DIRECTORY, File.basename(file)))
13
- end
9
+ def copy_dependencies(files)
10
+ files.each do |file|
11
+ FileUtils.cp_r(file, ::Rails.root.join("public", SOURCE_MAPS_DIRECTORY, File.basename(file)))
14
12
  end
13
+ end
15
14
 
16
- def evaluate(context, locals, &block)
17
- cache_store = SassCacheStore.new(context.environment)
18
- paths = context.environment.paths.map { |path| CompassRails::SpriteImporter.new(context, path) }
19
- paths += context.environment.paths.map { |path| CompassRailsSourceMaps::SassImporter.new(context, path) }
20
- paths += ::Rails.application.config.sass.load_paths
21
-
22
- options = CompassRails.sass_config.merge({
23
- sourcemap_filename: ::Sass::Util::sourcemap_name(basename),
24
- filename: eval_file,
25
- line: line,
26
- syntax: syntax,
27
- cache_store: cache_store,
28
- cache: ::Rails.application.config.assets.debug,
29
- line_numbers: ::Rails.application.config.sass.line_numbers,
30
- line_comments: ::Rails.application.config.sass.line_comments,
31
- importer: CompassRailsSourceMaps::SassImporter.new(context, context.pathname),
32
- load_paths: paths,
33
- sprockets: {
34
- context: context,
35
- environment: context.environment
36
- }
37
- })
15
+ alias_method :base_evaluate, :evaluate
16
+ def evaluate(context, locals, &block)
17
+ if self.class.name == 'CompassRails::SpriteImporter'
18
+ return base_evaluate(context, locals, &block)
19
+ end
20
+ cache_store = Sprockets::SassCacheStore.new(context.environment)
21
+ paths = context.environment.paths.map { |path| CompassRails::SpriteImporter.new(context, path) }
22
+ paths += context.environment.paths.map { |path| Sass::Rails::SassImporter.new(context, path) }
23
+ paths += ::Rails.application.config.sass.load_paths
38
24
 
39
- result, mapping = ::Sass::Engine.new(data, options).render_with_sourcemap("/#{SOURCE_MAPS_DIRECTORY}/#{options[:sourcemap_filename]}")
25
+ options = CompassRails.sass_config.merge({
26
+ sourcemap_filename: ::Sass::Util::sourcemap_name(basename),
27
+ filename: eval_file,
28
+ line: line,
29
+ syntax: syntax,
30
+ cache_store: cache_store,
31
+ cache: ::Rails.application.config.assets.debug,
32
+ line_numbers: ::Rails.application.config.sass.line_numbers,
33
+ line_comments: ::Rails.application.config.sass.line_comments,
34
+ importer: CompassRailsSourceMaps::SassImporter.new(context, context.pathname),
35
+ load_paths: paths,
36
+ sprockets: {
37
+ context: context,
38
+ environment: context.environment
39
+ }
40
+ })
41
+ result, mapping = ::Sass::Engine.new(data, options).render_with_sourcemap("/#{SOURCE_MAPS_DIRECTORY}/#{options[:sourcemap_filename]}")
40
42
 
41
- write_output(data, ::Rails.root.join("public", SOURCE_MAPS_DIRECTORY, basename).to_s)
42
- write_output(mapping.to_json(
43
- css_path: basename.gsub(".#{syntax.to_s}", ""),
44
- sourcemap_path: ::Rails.root.join("public", SOURCE_MAPS_DIRECTORY, options[:sourcemap_filename])) + "\n",
45
- ::Rails.root.join("public", SOURCE_MAPS_DIRECTORY, options[:sourcemap_filename]).to_s)
46
- copy_dependencies(context._dependency_paths)
43
+ write_output(data, ::Rails.root.join("public", SOURCE_MAPS_DIRECTORY, basename).to_s)
44
+ write_output(mapping.to_json(
45
+ css_path: basename.gsub(".#{syntax.to_s}", ""),
46
+ sourcemap_path: ::Rails.root.join("public", SOURCE_MAPS_DIRECTORY, options[:sourcemap_filename])) + "\n",
47
+ ::Rails.root.join("public", SOURCE_MAPS_DIRECTORY, options[:sourcemap_filename]).to_s)
48
+ copy_dependencies(context._dependency_paths)
47
49
 
48
- result
49
- rescue ::Sass::SyntaxError => e
50
- context.__LINE__ = e.sass_backtrace.first[:line]
51
- raise e
52
- end
50
+ result
51
+ rescue ::Sass::SyntaxError => e
52
+ context.__LINE__ = e.sass_backtrace.first[:line]
53
+ raise e
53
54
  end
54
55
  end
@@ -0,0 +1,7 @@
1
+ module Compass
2
+ class SpriteImporter < Sass::Importers::Base
3
+ def public_url(a = nil, b = nil)
4
+ nil
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module CompassRailsSourceMaps
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compass-rails-source-maps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebtv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-13 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: A small monkeypatch to enable sourcemaps with compass-rails
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
48
+ - ".gitignore"
49
49
  - Gemfile
50
50
  - LICENSE.txt
51
51
  - README.md
@@ -54,6 +54,7 @@ files:
54
54
  - lib/compass-rails-source-maps.rb
55
55
  - lib/compass-rails-source-maps/sass_importer.rb
56
56
  - lib/compass-rails-source-maps/sass_template.rb
57
+ - lib/compass-rails-source-maps/sprite_importer.rb
57
58
  - lib/compass-rails-source-maps/version.rb
58
59
  homepage: https://github.com/glebtv/compass-rails-source-map
59
60
  licenses:
@@ -65,17 +66,17 @@ require_paths:
65
66
  - lib
66
67
  required_ruby_version: !ruby/object:Gem::Requirement
67
68
  requirements:
68
- - - '>='
69
+ - - ">="
69
70
  - !ruby/object:Gem::Version
70
71
  version: '0'
71
72
  required_rubygems_version: !ruby/object:Gem::Requirement
72
73
  requirements:
73
- - - '>='
74
+ - - ">="
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
76
77
  requirements: []
77
78
  rubyforge_project:
78
- rubygems_version: 2.2.1
79
+ rubygems_version: 2.2.2
79
80
  signing_key:
80
81
  specification_version: 4
81
82
  summary: A small monkeypatch to enable sourcemaps with compass-rails