sassc-image-size 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 76d9ad208255608b1497c3afa0764231f9407865
4
+ data.tar.gz: 97dcb73e62f8b72813152df67912fb216814f2c7
5
+ SHA512:
6
+ metadata.gz: 78d706cc43b6cb377d972e422735da599f0dbf284521a28f3d8bcc0501607031ba7363c6595f0315bf5432c0977a07c0d4b344e26ec058f775d4c68c6b373de2
7
+ data.tar.gz: 9ffdae3ace5a505024a4b5d19d9a609e6084f0ca2da099e33fc72ed9c9e857c40becbdf219bd502e8fd44599aa2daf7dd498b170509a1c06f912eb01557f118f
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sassc-image-size.gemspec
4
+ gemspec
@@ -0,0 +1,44 @@
1
+ # Sassc::Image::Size
2
+
3
+ alternative version of [rails-sass-images.gem](https://github.com/ai/rails-sass-images). but, for [sassc-rails.gem](https://github.com/sass/sassc-rails).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'sassc-image-size'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install sassc-image-size
20
+
21
+ ## Usage
22
+
23
+ ```scss
24
+ .foo-image {
25
+ $foo-image-size: image-size('foo.png');
26
+ width: map-get($foo-image-size, width);
27
+ height: map-get($foo-image-size, height);
28
+ }
29
+
30
+ .bar-image {
31
+ width: image-width('bar.png');
32
+ height: image-height('bar.png');
33
+ }
34
+ ```
35
+
36
+ ## Development
37
+
38
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+
40
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
41
+
42
+ ## Contributing
43
+
44
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sassc-image-size.
@@ -0,0 +1,3 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sassc/image/size"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,23 @@
1
+ require 'sassc/script/functions'
2
+ require 'dimensions'
3
+ require 'sass/script/value/map'
4
+
5
+ module SassC
6
+ module Script
7
+ module Functions
8
+ def image_size(path)
9
+ dimensions = Dimensions.dimensions(sprockets_context.depend_on_asset(path.value).filename)
10
+ Sass::Script::Value::Map.new(Sass::Script::Value::String.new('width') => Sass::Script::Value::Number.new(dimensions[0], ['px']),
11
+ Sass::Script::Value::String.new('height') => Sass::Script::Value::Number.new(dimensions[1], ['px']))
12
+ end
13
+
14
+ def image_width(path)
15
+ Sass::Script::Value::Number.new(Dimensions.width(sprockets_context.depend_on_asset(path.value).filename), ['px'])
16
+ end
17
+
18
+ def image_height(path)
19
+ Sass::Script::Value::Number.new(Dimensions.height(sprockets_context.depend_on_asset(path.value).filename), ['px'])
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "sassc-image-size"
7
+ spec.version = "0.1.0"
8
+ spec.authors = ["miyucy"]
9
+ spec.email = ["fistfvck@gmail.com"]
10
+
11
+ spec.summary = %q{image-(size|width|height) function for sassc}
12
+ spec.description = %q{image-(size|width|height) function for sassc}
13
+ spec.homepage = "https://github.com/miyucy/sassc-image-size"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "dimensions"
21
+ spec.add_dependency "sassc-rails"
22
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sassc-image-size
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - miyucy
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dimensions
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sassc-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: image-(size|width|height) function for sassc
42
+ email:
43
+ - fistfvck@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - README.md
53
+ - Rakefile
54
+ - bin/console
55
+ - bin/setup
56
+ - lib/sassc/image/size.rb
57
+ - sassc-image-size.gemspec
58
+ homepage: https://github.com/miyucy/sassc-image-size
59
+ licenses: []
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.5.1
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: image-(size|width|height) function for sassc
81
+ test_files: []