svg_hearts_you 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +265 -0
  7. data/Rakefile +46 -0
  8. data/features/middleman.feature +19 -0
  9. data/features/step_definitions/steps.rb +3 -0
  10. data/features/support/env.rb +8 -0
  11. data/fixtures/middleman-extension-config-style/config.rb +1 -0
  12. data/fixtures/middleman-extension-config-style/source/circle.svg +7 -0
  13. data/fixtures/middleman-extension-config-style/source/index.html.erb +2 -0
  14. data/fixtures/middleman-extension-default-config/config.rb +1 -0
  15. data/fixtures/middleman-extension-default-config/source/images/circle.svg +7 -0
  16. data/fixtures/middleman-extension-default-config/source/index.html.erb +2 -0
  17. data/fixtures/middleman-svg_hearts_you-config-style/config.rb +6 -0
  18. data/fixtures/middleman-svg_hearts_you-config-style/source/circle.svg +7 -0
  19. data/fixtures/middleman-svg_hearts_you-config-style/source/index.html.erb +2 -0
  20. data/lib/svg_hearts_you.rb +11 -0
  21. data/lib/svg_hearts_you/configuration.rb +23 -0
  22. data/lib/svg_hearts_you/helpers.rb +165 -0
  23. data/lib/svg_hearts_you/middleman_extension.rb +31 -0
  24. data/lib/svg_hearts_you/module.rb +19 -0
  25. data/lib/svg_hearts_you/railtie.rb +9 -0
  26. data/lib/svg_hearts_you/version.rb +3 -0
  27. data/spec/module/configuration_spec.rb +18 -0
  28. data/spec/module/svg_hearts_you_spec.rb +192 -0
  29. data/spec/module/svgs/circle.svg +7 -0
  30. data/spec/module/svgs/logos/back-icon.svg +12 -0
  31. data/spec/module/svgs/logos/logout-icon.svg +15 -0
  32. data/spec/module/svgs/logos/plus-icon.svg +12 -0
  33. data/spec/module/svgs/logos/search-icon.svg +12 -0
  34. data/spec/module/svgs/logos/x-icon.svg +12 -0
  35. data/spec/module/svgs/sapphire.svg +15 -0
  36. data/spec/module/svgs/shapes/polygon.svg +10 -0
  37. data/spec/module/svgs/shapes/star.svg +10 -0
  38. data/spec/module/svgs/shapes/triangle.svg +10 -0
  39. data/spec/rails/dummy/README.rdoc +28 -0
  40. data/spec/rails/dummy/Rakefile +6 -0
  41. data/spec/rails/dummy/app/assets/images/.keep +0 -0
  42. data/spec/rails/dummy/app/assets/images/circle.svg +7 -0
  43. data/spec/rails/dummy/app/assets/images/circle_and_gems.svg +34 -0
  44. data/spec/rails/dummy/app/assets/images/logos/back-icon.svg +12 -0
  45. data/spec/rails/dummy/app/assets/images/logos/logout-icon.svg +15 -0
  46. data/spec/rails/dummy/app/assets/images/logos/plus-icon.svg +12 -0
  47. data/spec/rails/dummy/app/assets/images/logos/search-icon.svg +12 -0
  48. data/spec/rails/dummy/app/assets/images/logos/x-icon.svg +12 -0
  49. data/spec/rails/dummy/app/assets/images/shapes/polygon.svg +10 -0
  50. data/spec/rails/dummy/app/assets/images/shapes/star.svg +10 -0
  51. data/spec/rails/dummy/app/assets/images/shapes/triangle.svg +10 -0
  52. data/spec/rails/dummy/app/assets/javascripts/application.js +13 -0
  53. data/spec/rails/dummy/app/assets/stylesheets/application.css +15 -0
  54. data/spec/rails/dummy/app/controllers/application_controller.rb +5 -0
  55. data/spec/rails/dummy/app/controllers/concerns/.keep +0 -0
  56. data/spec/rails/dummy/app/controllers/pages_controller.rb +7 -0
  57. data/spec/rails/dummy/app/helpers/application_helper.rb +2 -0
  58. data/spec/rails/dummy/app/mailers/.keep +0 -0
  59. data/spec/rails/dummy/app/models/.keep +0 -0
  60. data/spec/rails/dummy/app/models/concerns/.keep +0 -0
  61. data/spec/rails/dummy/app/views/layouts/application.html.erb +13 -0
  62. data/spec/rails/dummy/app/views/pages/basic.html.erb +13 -0
  63. data/spec/rails/dummy/app/views/pages/folder.html.erb +8 -0
  64. data/spec/rails/dummy/bin/bundle +3 -0
  65. data/spec/rails/dummy/bin/rails +4 -0
  66. data/spec/rails/dummy/bin/rake +4 -0
  67. data/spec/rails/dummy/config.ru +4 -0
  68. data/spec/rails/dummy/config/application.rb +27 -0
  69. data/spec/rails/dummy/config/boot.rb +5 -0
  70. data/spec/rails/dummy/config/database.yml +25 -0
  71. data/spec/rails/dummy/config/environment.rb +5 -0
  72. data/spec/rails/dummy/config/environments/development.rb +37 -0
  73. data/spec/rails/dummy/config/environments/production.rb +82 -0
  74. data/spec/rails/dummy/config/environments/test.rb +39 -0
  75. data/spec/rails/dummy/config/initializers/assets.rb +8 -0
  76. data/spec/rails/dummy/config/initializers/backtrace_silencers.rb +7 -0
  77. data/spec/rails/dummy/config/initializers/cookies_serializer.rb +3 -0
  78. data/spec/rails/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  79. data/spec/rails/dummy/config/initializers/inflections.rb +16 -0
  80. data/spec/rails/dummy/config/initializers/mime_types.rb +4 -0
  81. data/spec/rails/dummy/config/initializers/session_store.rb +3 -0
  82. data/spec/rails/dummy/config/initializers/wrap_parameters.rb +14 -0
  83. data/spec/rails/dummy/config/locales/en.yml +23 -0
  84. data/spec/rails/dummy/config/routes.rb +60 -0
  85. data/spec/rails/dummy/config/secrets.yml +22 -0
  86. data/spec/rails/dummy/db/development.sqlite3 +0 -0
  87. data/spec/rails/dummy/db/schema.rb +16 -0
  88. data/spec/rails/dummy/db/test.sqlite3 +0 -0
  89. data/spec/rails/dummy/lib/assets/.keep +0 -0
  90. data/spec/rails/dummy/log/.keep +0 -0
  91. data/spec/rails/dummy/public/404.html +67 -0
  92. data/spec/rails/dummy/public/422.html +67 -0
  93. data/spec/rails/dummy/public/500.html +66 -0
  94. data/spec/rails/dummy/public/favicon.ico +0 -0
  95. data/spec/rails/features/rails_svg_spec.rb +56 -0
  96. data/spec/spec_helper.rb +23 -0
  97. data/svg_hearts_you.gemspec +46 -0
  98. metadata +463 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1cfb040951e1ad1f610d820f53eb70c852634209
4
+ data.tar.gz: 0cd23ef733ce5f3ee4f20eb8bf57846ba23d3bab
5
+ SHA512:
6
+ metadata.gz: 1c03eca824b4cb992e1ce10f1e07386959e30951c0ab1b42b274a97920e9dff8c223fecdc843f278c391892d6f5da5bc283e203d9a2a850407c24e92577611fd
7
+ data.tar.gz: 06e1dd0fbf5b5383d019cf3346d7b37f5f2d4d1899b5c124b1082b215410083f8275f8e993812d9514569b4c4af7a6ae76d01d8431a441bc737526e4d0019a50
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in svg_hearts_you.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Nathanael Beisiegel
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.
@@ -0,0 +1,265 @@
1
+ <img src="https://cloud.githubusercontent.com/assets/1911028/5623119/0145adf6-951c-11e4-922b-026db7584cd6.png" width="170px" height="228">
2
+
3
+ # SVG ❤’s You
4
+
5
+ SVG that you can target with CSS is really great for icons and fun illustrations, but it can be a big headache to get into the DOM from a file made in an editor. It becomes even more clumsy when you want to tweak that file back in a vector image editor and then have to re-copy everything back into the appropriate places. I got sick of doing this, so I created this gem to help include SVG files at the view level.
6
+
7
+ **SVG ❤’s You** provides methods to help inline, symbolize, and externally `<use>` SVG files. It pulls in files and parses them so that you can still edit them and simply refresh the page to see the updated SVG code in your browser.
8
+
9
+ Seriously, stop copy/pasting SVG text.
10
+
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```
17
+ gem 'svg_hearts_you'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ ```
23
+ $ bundle
24
+ ```
25
+
26
+ Or install on your machine with:
27
+
28
+ ```
29
+ $ gem install svg_hearts_you
30
+ ```
31
+
32
+ ## Configuration
33
+
34
+ In a Rails app, **SVG ❤’s You** is already configured to use the app's `image_paths` by default. In Middleman, **SVG ❤’s You** uses `images_dir` by
35
+ default.
36
+
37
+ If you are in another environment or want to add custom search paths, you can configure the gem by the adding to the svg_paths array in the gem's configuration like so:
38
+
39
+ ```
40
+ SvgHeartsYou.configure do |config|
41
+ config.svg_paths << '/some/path/here'
42
+ # or
43
+ config.svg_paths += ['/one/path', '/two/path']
44
+ end
45
+ ```
46
+
47
+
48
+
49
+ ## Usage
50
+
51
+ **SVG ❤’s You** provides the following helper methods. These methods are automatically exposed to views in Rails and Middleman. In other environments, use the class methods on the SvgHeartsYou module (i.e. `SvgHeartsYou.svg_use 'hello'`).
52
+
53
+ ---
54
+
55
+ ### `svg_inline(filename, options={})`
56
+
57
+ Quickly inline a svg from a given file. It searches the configured `svg_paths` for a filename, otherwise throws a runtime error on file not found. Any attributes provided are placed as attributes on the `<svg>` tag.
58
+
59
+ #### Usage (ERB)
60
+
61
+ ```
62
+ <%= svg_inline 'circle', id: 'my-pretty-circle', class: 'logo' %>
63
+ ```
64
+
65
+ #### Output
66
+
67
+ ```
68
+ <svg id="my-pretty-circle" class="logo" (existing attributes in file...)>
69
+ <!-- Contents of circle.svg file -->
70
+ </svg>
71
+ ```
72
+
73
+ ---
74
+
75
+ ### `svg_symbol(filenames, options={})`
76
+
77
+ Takes a single filename (string) or list of filenames (list of strings) and converts all the given svg files into symbols within one svg tag. This is useful for reuse in the document with the `<use>` tag (see `svg_use` below). Chris Coyier wrote a [very useful guide](http://css-tricks.com/svg-symbol-good-choice-icons/) about using symbols.
78
+
79
+ Takes a hash of parameters. The specified keys in the hash change behavior, all
80
+ other keys are added as parameters to the parent `<svg>` tag.
81
+
82
+ * `:folder` — If set to true, the method will look for a folder(s) and symbolize
83
+ all svg files within it(them). Each symbol tag will have the `id` attribute
84
+ set to the original file name of each svg file.
85
+ * `:each` — If this is set to a hash, all key-value pairs passed in will appear
86
+ as attributes on each `<symbol>` tag.
87
+ * `&block` — A block can be supplied that is given an `attributes` object that
88
+ contains the attributes for each symbol tag. Any modifications to this hash
89
+ will be output to the final `<symbol>` tag. See example #4 below.
90
+
91
+
92
+ #### Usage (ERB)
93
+
94
+ ```
95
+ <!-- 1 -->
96
+ <%= svg_symbol 'circle', class: 'shapes' %>
97
+
98
+ <!-- 2 -->
99
+ <%= svg_symbol ['circle', 'square'], class: 'shapes', each: {class: 'shape'} %>
100
+
101
+ <!-- 3 -->
102
+ <!-- folder contains circle.svg, square.svg, and triangle.svg -->
103
+ <%= svg_symbol 'all-my-shapes', folder: true %>
104
+
105
+ <!-- 4 -->
106
+ <%= svg_symbol 'all-my-shapes', folder: true do |attributes| %>
107
+ <% attributes[:class] = 'shape' %>
108
+ <% attributes[:id] = attributes[:id] + '-logo' %>
109
+ <% end %>
110
+ ```
111
+
112
+ #### Output
113
+
114
+ ```
115
+ <!-- 1 -->
116
+ <svg class="shapes">
117
+ <symbol id="circle" (existing attributes on circle.svg <svg> tag...)>
118
+ <!-- Contents of circle.svg file -->
119
+ </symbol>
120
+ </svg>
121
+
122
+
123
+ <!-- 2 -->
124
+ <svg class="shapes">
125
+ <symbol id="circle" class="shape" ...)>
126
+ <!-- Contents of circle.svg file -->
127
+ </symbol>
128
+ <symbol id="square" class="shape" ...)>
129
+ <!-- Contents of square.svg file -->
130
+ </symbol>
131
+ </svg>
132
+
133
+ <!-- 3 -->
134
+ <svg>
135
+ <symbol id="circle" ...>
136
+ <!-- Contents of circle.svg file -->
137
+ </symbol>
138
+ <symbol id="square" ...>
139
+ <!-- Contents of square.svg file -->
140
+ </symbol>
141
+ <symbol id="triangle" ...>
142
+ <!-- Contents of triangle.svg file -->
143
+ </symbol>
144
+ </svg>
145
+
146
+
147
+ <!-- 4 -->
148
+ <svg>
149
+ <symbol id="circle-logo" class="shape" ...>
150
+ <!-- Contents of circle.svg file -->
151
+ </symbol>
152
+ <symbol id="square-logo" class="shape" ...>
153
+ <!-- Contents of square.svg file -->
154
+ </symbol>
155
+ <symbol id="triangle-logo" class="shape" ...>
156
+ <!-- Contents of triangle.svg file -->
157
+ </symbol>
158
+ </svg>
159
+ ```
160
+
161
+
162
+
163
+ ---
164
+
165
+ ### `svg_use(id, options={})`
166
+
167
+ Helper method to use a previously defined symbol by using it's id (typically it's filename unless you modified it). You can also target symbols in external files, which is great for cacheablility. Unfortunately, IE and old Android browsers can't handle `<use>` tags with external sources, but [there's a polyfill for that](https://github.com/jonathantneal/svg4everybody). Chris Coyier [covered this in more detail](http://css-tricks.com/svg-use-external-source/).
168
+
169
+
170
+ #### Usage (ERB)
171
+
172
+ ```
173
+ <!-- 1 & 2 -->
174
+ <%= svg_use 'circle', class: 'logo' %>
175
+ <!-- or -->
176
+ <%= svg_use '#circle', class: 'logo' %>
177
+
178
+ <!-- 3 -->
179
+ <%= svg_use 'my-external-symbols.svg#circle' %>
180
+
181
+ ```
182
+
183
+ #### Output
184
+
185
+ ```
186
+ <!-- 1 & 2 -->
187
+ <svg class="logo" version="1.1" xmlns="http://www.w3.org/2000/svg">
188
+ <use xlink:href="#circle">
189
+ </svg>
190
+
191
+ <!-- 3 -->
192
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg">
193
+ <use xlink:href="my-external-symbols.svg#circle">
194
+ </svg>
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Thoughts, some use cases, and further reading
200
+
201
+ If you have got this far and haven't seen Chris Coyier's articles on using SVG
202
+ for icons as symbols, I recommend looking at them.
203
+
204
+ 1. http://css-tricks.com/svg-symbol-good-choice-icons/
205
+ 1. http://css-tricks.com/svg-use-external-source/
206
+ 1. http://css-tricks.com/gotchas-on-getting-svg-into-production/
207
+
208
+ If you are like me and don't want to think, `svg_inline` is dead simple to inline a file into the page. This gives you the most control and is the simplest to understand. The big drawback is that it can be a lot of markup to copy into your document that can't be cached. Best to use this if you need absolute control over some illustration with CSS.
209
+
210
+ If you are going to reuse the same icon on a page, take advantage of svg `<symbol>`. It allows you to reuse the same SVG content multiple times without
211
+ the bloat of copying the same markup. The `svg_symbol` and `svg_use` functions should make this pretty simple. CSS styling does have a few gotchas when you
212
+ are using `<use>`, so make sure to see [CSS tricks article about all the gotchas](http://css-tricks.com/gotchas-on-getting-svg-into-production/).
213
+
214
+
215
+
216
+
217
+ Even better—make an external file with each svg file as a symbol. The `svg_symbol` function can be used with sprockets to prep a file of
218
+ symbols (that can be externally used with the `<use>` tag.
219
+
220
+ You can create a new svg file that will be dynamically generated with ERB. For
221
+ example, a file named `my-symbols.svg.erb` with the following contents
222
+
223
+ ```
224
+ <?xml version="1.0" encoding="UTF-8"?>
225
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
226
+
227
+ <%= svg_symbol ['each', 'folder', 'and/subfolder'], folder: true %>
228
+ ```
229
+
230
+ creates one main file with symbols for each SVG file that can be used externally, like so:
231
+
232
+ ```
233
+ <%= svg_use 'my-symbols.svg#circle' %>
234
+ ```
235
+
236
+ This is pretty simple once it's set up, but unfortunately it needs [a polyfill](https://github.com/jonathantneal/svg4everybody)
237
+ to work with IE and old Android browsers.
238
+
239
+
240
+ ## Contributing
241
+
242
+ ### Basics
243
+
244
+ 1. [Fork it]( https://github.com/pknb/svg_hearts_you/fork )
245
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
246
+ 1. Commit your changes (`git commit -am 'Add some feature'`)
247
+ 1. Push to the branch (`git push -u origin my-new-feature`)
248
+ 1. When finished, [squash commits (easiest into new branch)](https://github.com/ginatrapani/todo.txt-android/wiki/Squash-All-Commits-Related-to-a-Single-Issue-into-a-Single-Commit)
249
+ * Example (*from feature branch*)
250
+ * `git checkout -b 'my-new-feature-squashed'`
251
+ * `git rebase -i HEAD~#` (Squash # commits, changing # to real value)
252
+ * Push up the new branch
253
+ 1. Create a new Pull Request with squashed branch
254
+
255
+ **Make sure** all tests pass with `bundle exec rake test`, and add appropriate
256
+ tests for whatever additions you add. Currently Middleman functionality is
257
+ tested through cucumber features and fixtures, taking advantage of step
258
+ definitions in `middleman-core`. Unit tests and rails feature tests are in
259
+ `spec`. The rails features use a dummy rails app for testing under
260
+ `spec/rails/dummy`. If you want to just try stuff out in the console, there is
261
+ a rake tast that loads the gem definition into an `irb` session. Just run
262
+ `bundle exec rake console`.
263
+
264
+ There is no formal style guide, but please try to stick with the current code
265
+ style—2 space indents, only one new line at end of file, etc.
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env rake
2
+
3
+ #!/usr/bin/env rake
4
+ begin
5
+ require 'bundler/setup'
6
+ rescue LoadError
7
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
8
+ end
9
+
10
+ APP_RAKEFILE = File.expand_path("../spec/rails/dummy/Rakefile", __FILE__)
11
+ load 'rails/tasks/engine.rake'
12
+
13
+ require 'rdoc/task'
14
+ require 'rspec/core'
15
+ require 'rspec/core/rake_task'
16
+
17
+ # RDoc::Task.new(:rdoc) do |rdoc|
18
+ # rdoc.rdoc_dir = 'rdoc'
19
+ # rdoc.title = 'SvgHeartsYou'
20
+ # rdoc.options << '--line-numbers'
21
+ # rdoc.rdoc_files.include('README.rdoc')
22
+ # rdoc.rdoc_files.include('lib/**/*.rb')
23
+ # end
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ # Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
28
+
29
+ require 'cucumber/rake/task'
30
+
31
+ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |task|
32
+ task.cucumber_opts = '--color --tags ~@wip --strict --format pretty'
33
+ end
34
+
35
+ desc "Run all specs in spec directory (excluding plugin specs)"
36
+ RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare') do |task|
37
+ task.rspec_opts = ['--color']
38
+ end
39
+
40
+ desc "Open an irb session preloaded with this library"
41
+ task :console do
42
+ sh "irb -rubygems -I lib -r svg_hearts_you.rb"
43
+ end
44
+
45
+ task :default => :spec
46
+ task :test => [:spec, :cucumber]
@@ -0,0 +1,19 @@
1
+ Feature: SvgHeartsYou gem in a middleman app
2
+
3
+ Scenario: Configuring gem with SvgHeartsYou config block
4
+ Given the Server is running at "middleman-svg_hearts_you-config-style"
5
+ When I go to "/index.html"
6
+ Then I should see "<svg"
7
+ Then reset SvgHeartsYou configuration
8
+
9
+ Scenario: Configuring gem with Middleman extension
10
+ Given the Server is running at "middleman-extension-config-style"
11
+ When I go to "/index.html"
12
+ Then I should see "<svg"
13
+ Then reset SvgHeartsYou configuration
14
+
15
+ Scenario: Configuring gem with Middleman extension
16
+ Given the Server is running at "middleman-extension-default-config"
17
+ When I go to "/index.html"
18
+ Then I should see "<svg"
19
+ Then reset SvgHeartsYou configuration
@@ -0,0 +1,3 @@
1
+ Then /^reset SvgHeartsYou configuration$/ do
2
+ SvgHeartsYou.reset
3
+ end
@@ -0,0 +1,8 @@
1
+ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
2
+ require 'middleman-core'
3
+ require 'middleman-core/step_definitions'
4
+
5
+ # require 'codeclimate-test-reporter'
6
+ # CodeClimate::TestReporter.start
7
+
8
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'svg_hearts_you')
@@ -0,0 +1 @@
1
+ activate :svg_hearts_you, svg_paths: File.join(PROJECT_ROOT_PATH, 'fixtures', 'middleman-extension-config-style', 'source')
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="100" height="100" viewBox="0, 0, 100, 100">
4
+ <g id="Layer_1">
5
+ <path d="M50,100 C22.386,100 0,77.614 0,50 C0,22.386 22.386,0 50,-0 C77.614,-0 100,22.386 100,50 C100,77.614 77.614,100 50,100 z" fill="#4B5A65"/>
6
+ </g>
7
+ </svg>
@@ -0,0 +1,2 @@
1
+ <h1>Test</h1>
2
+ <%= svg_inline 'circle.svg' %>
@@ -0,0 +1 @@
1
+ activate :svg_hearts_you
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="100" height="100" viewBox="0, 0, 100, 100">
4
+ <g id="Layer_1">
5
+ <path d="M50,100 C22.386,100 0,77.614 0,50 C0,22.386 22.386,0 50,-0 C77.614,-0 100,22.386 100,50 C100,77.614 77.614,100 50,100 z" fill="#4B5A65"/>
6
+ </g>
7
+ </svg>
@@ -0,0 +1,2 @@
1
+ <h1>Test</h1>
2
+ <%= svg_inline 'circle.svg' %>
@@ -0,0 +1,6 @@
1
+ activate :svg_hearts_you
2
+
3
+ SvgHeartsYou.configure do |config|
4
+ # binding.pry
5
+ config.svg_paths << File.join(PROJECT_ROOT_PATH, 'fixtures', 'middleman-svg_hearts_you-config-style', 'source')
6
+ end