sassc-rails-svg-data-url 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +6 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +87 -0
- data/README.md +23 -0
- data/lib/sassc-rails-svg-data-url.rb +17 -0
- data/lib/sassc-rails-svg-data-url/version.rb +8 -0
- data/sassc-rails-svg-data-url.gemspec +21 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8eb0c38c278772deb2835016c7f2c54ba37c0a33
|
4
|
+
data.tar.gz: 11fd5f804f432e6fc0950efffe6b73bd07891b82
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a88f6699093fb937b9f4a47aa9d7bb2f2b049da32f8ce78648918bc4f038d4556be1395d092d8c23d3a901382184af5b68d8e2dcbfa04549af10e3264c449601
|
7
|
+
data.tar.gz: f6cb42d009fd521ef91b9f017036c6e75416295de729f30a1164bf8451bdddcac4ac4b1350b5a67f7c507136443afff7517eee198ff22a24ff828cad7e0c70c3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
sassc-rails-svg-data-url (1.0.0)
|
5
|
+
sassc-rails (~> 1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (5.0.1)
|
11
|
+
actionview (= 5.0.1)
|
12
|
+
activesupport (= 5.0.1)
|
13
|
+
rack (~> 2.0)
|
14
|
+
rack-test (~> 0.6.3)
|
15
|
+
rails-dom-testing (~> 2.0)
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
17
|
+
actionview (5.0.1)
|
18
|
+
activesupport (= 5.0.1)
|
19
|
+
builder (~> 3.1)
|
20
|
+
erubis (~> 2.7.0)
|
21
|
+
rails-dom-testing (~> 2.0)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
+
activesupport (5.0.1)
|
24
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
|
+
i18n (~> 0.7)
|
26
|
+
minitest (~> 5.1)
|
27
|
+
tzinfo (~> 1.1)
|
28
|
+
builder (3.2.3)
|
29
|
+
concurrent-ruby (1.0.5)
|
30
|
+
erubis (2.7.0)
|
31
|
+
ffi (1.9.18)
|
32
|
+
i18n (0.8.1)
|
33
|
+
loofah (2.0.3)
|
34
|
+
nokogiri (>= 1.5.9)
|
35
|
+
method_source (0.8.2)
|
36
|
+
mini_portile2 (2.1.0)
|
37
|
+
minitest (5.10.1)
|
38
|
+
nokogiri (1.7.1)
|
39
|
+
mini_portile2 (~> 2.1.0)
|
40
|
+
rack (2.0.1)
|
41
|
+
rack-test (0.6.3)
|
42
|
+
rack (>= 1.0)
|
43
|
+
rails-dom-testing (2.0.2)
|
44
|
+
activesupport (>= 4.2.0, < 6.0)
|
45
|
+
nokogiri (~> 1.6)
|
46
|
+
rails-html-sanitizer (1.0.3)
|
47
|
+
loofah (~> 2.0)
|
48
|
+
railties (5.0.1)
|
49
|
+
actionpack (= 5.0.1)
|
50
|
+
activesupport (= 5.0.1)
|
51
|
+
method_source
|
52
|
+
rake (>= 0.8.7)
|
53
|
+
thor (>= 0.18.1, < 2.0)
|
54
|
+
rake (12.0.0)
|
55
|
+
sass (3.4.23)
|
56
|
+
sassc (1.11.2)
|
57
|
+
bundler
|
58
|
+
ffi (~> 1.9.6)
|
59
|
+
sass (>= 3.3.0)
|
60
|
+
sassc-rails (1.3.0)
|
61
|
+
railties (>= 4.0.0)
|
62
|
+
sass
|
63
|
+
sassc (~> 1.9)
|
64
|
+
sprockets (> 2.11)
|
65
|
+
sprockets-rails
|
66
|
+
tilt
|
67
|
+
sprockets (3.7.1)
|
68
|
+
concurrent-ruby (~> 1.0)
|
69
|
+
rack (> 1, < 3)
|
70
|
+
sprockets-rails (3.2.0)
|
71
|
+
actionpack (>= 4.0)
|
72
|
+
activesupport (>= 4.0)
|
73
|
+
sprockets (>= 3.0.0)
|
74
|
+
thor (0.19.4)
|
75
|
+
thread_safe (0.3.6)
|
76
|
+
tilt (2.0.7)
|
77
|
+
tzinfo (1.2.2)
|
78
|
+
thread_safe (~> 0.1)
|
79
|
+
|
80
|
+
PLATFORMS
|
81
|
+
ruby
|
82
|
+
|
83
|
+
DEPENDENCIES
|
84
|
+
sassc-rails-svg-data-url!
|
85
|
+
|
86
|
+
BUNDLED WITH
|
87
|
+
1.14.3
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
## Adds `svg_data_url` as a Sass function.
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/sassc-rails-svg-data-url.svg)](https://badge.fury.io/rb/sassc-rails-svg-data-url)
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
**Input**
|
7
|
+
```sass
|
8
|
+
.block
|
9
|
+
background: svg-data-url('radio-toggle-active.svg') no-repeat center center
|
10
|
+
```
|
11
|
+
|
12
|
+
**Output**
|
13
|
+
```css
|
14
|
+
.block {
|
15
|
+
background: url('data:image/svg+xml;charset=utf-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2220%22 height=%2220%22 viewBox=%220 0 20 20%22 version=%221.1%22%3E%3Cpath fill=%22%23439CD7%22 fill-rule=%22evenodd%22 d=%22M10,5 C7.2,5 5,7.2 5,10 C5,12.8 7.2,15 10,15 C12.8,15 15,12.8 15,10 C15,7.2 12.8,5 10,5 L10,5 L10,5 Z M10,0 C4.5,0 0,4.5 0,10 C0,15.5 4.5,20 10,20 C15.5,20 20,15.5 20,10 C20,4.5 15.5,0 10,0 L10,0 L10,0 Z M10,18 C5.6,18 2,14.4 2,10 C2,5.6 5.6,2 10,2 C14.4,2 18,5.6 18,10 C18,14.4 14.4,18 10,18 L10,18 L10,18 Z%22/%3E%3C/svg%3E') no-repeat center center;
|
16
|
+
}
|
17
|
+
```
|
18
|
+
|
19
|
+
## Installing gem
|
20
|
+
Add to your Gemfile:
|
21
|
+
```ruby
|
22
|
+
gem 'sassc-rails-svg-data-url', '~> 1.0'
|
23
|
+
```
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'sassc-rails'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
module SassC::SVGDataURL
|
8
|
+
module Functions
|
9
|
+
def svg_data_url(path)
|
10
|
+
sprockets_context.depend_on_asset(path.value)
|
11
|
+
data = File.read(Rails.root.join('app', 'assets', 'images', path.value))
|
12
|
+
SassC::Script::String.new("url('data:image/svg+xml;charset=utf-8," + URI.escape(data) + "')")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
SassC::Script::Functions.include SassC::SVGDataURL::Functions
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require File.expand_path('../lib/sassc-rails-svg-data-url/version', __FILE__)
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'sassc-rails-svg-data-url'
|
8
|
+
s.version = SassC::SVGDataURL::VERSION
|
9
|
+
s.author = 'Yaroslav Konoplov'
|
10
|
+
s.email = 'eahome00@gmail.com'
|
11
|
+
s.summary = 'Adds svg_data_url as a Sass function.'
|
12
|
+
s.description = 'Adds svg_data_url as a Sass function.'
|
13
|
+
s.homepage = 'https://github.com/yivo/sassc-rails-svg-data-url'
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.files = `git ls-files -z`.split("\x0")
|
17
|
+
s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
s.add_dependency 'sassc-rails', '~> 1'
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sassc-rails-svg-data-url
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yaroslav Konoplov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sassc-rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
27
|
+
description: Adds svg_data_url as a Sass function.
|
28
|
+
email: eahome00@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- ".gitignore"
|
34
|
+
- ".travis.yml"
|
35
|
+
- Gemfile
|
36
|
+
- Gemfile.lock
|
37
|
+
- README.md
|
38
|
+
- lib/sassc-rails-svg-data-url.rb
|
39
|
+
- lib/sassc-rails-svg-data-url/version.rb
|
40
|
+
- sassc-rails-svg-data-url.gemspec
|
41
|
+
homepage: https://github.com/yivo/sassc-rails-svg-data-url
|
42
|
+
licenses:
|
43
|
+
- MIT
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.6.8
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: Adds svg_data_url as a Sass function.
|
65
|
+
test_files: []
|