compass-svg-sprites 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +1 -0
- data/compass-svg-sprites.gemspec +25 -0
- data/lib/compass-svg-sprites.rb +3 -0
- data/lib/sass_functions.rb +42 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 397f1d7134e2adccb27c376554333cfef74b2543
|
4
|
+
data.tar.gz: 6fc2edbcba889f6c8069b13e83b9d73beedb3c5e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e3b749ac40778a8d54b56bc9057f4ad168116e8597612d95eece1235b33125c584ff252e3e455058a1a7097c2e6d23e294e1f581d11b6deb4e02bca8458e7b83
|
7
|
+
data.tar.gz: c676a89a1e772d3f80cb2f0797e42b774062bd5a0d71cc2e9ab78552ec5fb0af4903385319e383df1de514043a0a2960de9022df262773a207e03b56499eed58
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Steve Hoeksema
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Compass SVG Sprites
|
2
|
+
|
3
|
+
Convert a folder of SVGs to PNGs using Compass
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'compass-svg-sprites'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install compass-svg-sprites
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
@if svg-sprites("inbox") {}
|
22
|
+
@import "inbox/*.png";
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
1. Fork it ( http://github.com/steveh/compass-svg-sprites/fork )
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
30
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,25 @@
|
|
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 = "compass-svg-sprites"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["Steve Hoeksema"]
|
9
|
+
spec.email = ["steve@thefold.co.nz"]
|
10
|
+
spec.summary = %q{Convert a folder of SVGs to PNGs}
|
11
|
+
spec.description = %q{Convert a folder of SVGs to PNGs using Compass}
|
12
|
+
spec.homepage = "https://github.com/steveh/compass-svg-sprites/"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
22
|
+
|
23
|
+
spec.add_dependency "compass", "~> 0.12"
|
24
|
+
spec.add_dependency "mini_magick", "~> 3.7"
|
25
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "mini_magick"
|
2
|
+
|
3
|
+
module Sass::Script::Functions
|
4
|
+
def svg_sprite_files(directory)
|
5
|
+
Compass.configuration.sprite_load_path.compact.each do |compass_directory|
|
6
|
+
files = Sass::Util.glob(File.join(compass_directory, directory)).sort
|
7
|
+
next if files.empty?
|
8
|
+
return files
|
9
|
+
end
|
10
|
+
|
11
|
+
path = Compass.configuration.sprite_load_path.to_a.join(", ")
|
12
|
+
raise Compass::SpriteException, %Q{No files were found in the load path matching "#{directory}". Your current load paths are: #{path}}
|
13
|
+
end
|
14
|
+
|
15
|
+
def svg_sprites(directory)
|
16
|
+
assert_type directory, :String
|
17
|
+
|
18
|
+
logger = Compass::Logger.new
|
19
|
+
|
20
|
+
svg_sprite_files(directory.value).each do |absolute_directory|
|
21
|
+
Dir.glob(File.join(absolute_directory, "*.svg")).each do |svg_path|
|
22
|
+
png_filename = File.basename(svg_path, ".svg") + ".png"
|
23
|
+
|
24
|
+
png_path = File.join(File.dirname(svg_path), png_filename)
|
25
|
+
|
26
|
+
if File.exists? png_path
|
27
|
+
logger.record :overwrite, png_path
|
28
|
+
else
|
29
|
+
logger.record :create, png_path
|
30
|
+
end
|
31
|
+
|
32
|
+
image = MiniMagick::Image.open(svg_path)
|
33
|
+
image.format "png"
|
34
|
+
image.write png_path
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Sass::Script::Bool.new true
|
39
|
+
end
|
40
|
+
|
41
|
+
declare :svg_sprites, :args => [:String]
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: compass-svg-sprites
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steve Hoeksema
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: compass
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.12'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mini_magick
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.7'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.7'
|
69
|
+
description: Convert a folder of SVGs to PNGs using Compass
|
70
|
+
email:
|
71
|
+
- steve@thefold.co.nz
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- compass-svg-sprites.gemspec
|
82
|
+
- lib/compass-svg-sprites.rb
|
83
|
+
- lib/sass_functions.rb
|
84
|
+
homepage: https://github.com/steveh/compass-svg-sprites/
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.2.0
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Convert a folder of SVGs to PNGs
|
108
|
+
test_files: []
|
109
|
+
has_rdoc:
|