front_man 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +63 -2
- data/app/helpers/front_man/images_helper.rb +10 -2
- data/front_man.gemspec +2 -0
- data/lib/front_man/core_ext/middleman.rb +13 -0
- data/lib/front_man/core_ext/railtie.rb +8 -0
- data/lib/front_man/version.rb +1 -1
- data/lib/front_man.rb +7 -1
- metadata +18 -4
- data/lib/front_man/engine.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a10787fabe7a96368a32944056daadb118c1b33f
|
4
|
+
data.tar.gz: 0ed139a951bb8a553b2400cf9b0cdfc84180bab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6c95800f8a0cb67927e54d1bead625ecf2e404b57b4b5b6135de775f1f8a3a3fcbcbdb0f88ac33af38f55cbbe0c9004b88188a9430c512e96a17afef3f323d7
|
7
|
+
data.tar.gz: 2d211696e64cfe6077b3f66d77de38a8a75d5207336498853735e1e7a61617e22922b19d04456200264f22d83b9d52db78a86545d7936854cbe2ef278327b94c
|
data/README.md
CHANGED
@@ -16,6 +16,14 @@ And then execute:
|
|
16
16
|
$ bundle
|
17
17
|
```
|
18
18
|
|
19
|
+
### Middleman
|
20
|
+
|
21
|
+
If you're using middleman, add this line to `config.rb`:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
activate :front_man
|
25
|
+
```
|
26
|
+
|
19
27
|
## Usage
|
20
28
|
|
21
29
|
Import front_man in your `application.scss`:
|
@@ -30,15 +38,68 @@ Or if you want to import components manually:
|
|
30
38
|
@import 'front_man/z-index';
|
31
39
|
```
|
32
40
|
|
33
|
-
Make sure the file has .scss extension (or .sass for Sass syntax). If you
|
41
|
+
Make sure the `application.scss` file has .scss extension (or .sass for Sass syntax). If you
|
42
|
+
have just generated a new Rails app, it may come with a .css file instead. If this file
|
43
|
+
exists, it will be served instead of Sass, so rename it:
|
34
44
|
|
35
45
|
```bash
|
36
46
|
$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss
|
37
47
|
```
|
38
48
|
|
49
|
+
### Helper methods
|
50
|
+
|
51
|
+
The front_man gem includes several helper methods.
|
52
|
+
|
53
|
+
#### inline_svg(filename)
|
54
|
+
|
55
|
+
Renders svg file in a hidden div for later referencing of it's elements; usually used to load
|
56
|
+
a single svg file that consists of all svg files concatenated together.
|
57
|
+
|
58
|
+
Example (you can put this at the bottom of your layout (`application.html.erb`) file:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
<%= inline_svg('icons.svg') %>
|
62
|
+
```
|
63
|
+
|
64
|
+
#### sprite_tag(filename, options = {})
|
65
|
+
|
66
|
+
Works together with `inline_svg` to serve specific svg file from concatenated file.
|
67
|
+
|
68
|
+
Example:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
<%= sprite_tag('icon-home', class: 'svgIcon svgIcon-40') %>
|
72
|
+
```
|
73
|
+
|
74
|
+
You can use css classes to style the icon:
|
75
|
+
|
76
|
+
```scss
|
77
|
+
.svgIcon-40 {
|
78
|
+
width: 40px;
|
79
|
+
height: 40px;
|
80
|
+
fill: $base-color; // use fill instead of color
|
81
|
+
}
|
82
|
+
```
|
83
|
+
|
84
|
+
All the options passed to sprite_tag are passed on to svg content_tag.
|
85
|
+
|
86
|
+
#### image_set\_tag(filename, options = {})
|
87
|
+
|
88
|
+
Used to set `srcset` attribute on `img` tag.
|
89
|
+
|
90
|
+
Example:
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
image_set_tag(item.image.medium, srcset: {
|
94
|
+
item.image.thumb => '200w',
|
95
|
+
item.image.medium => '600w',
|
96
|
+
item.image.large => '800w'
|
97
|
+
})
|
98
|
+
```
|
99
|
+
|
39
100
|
## Kudos
|
40
101
|
|
41
|
-
The conventions laid out here were based upon those discussed in the article below. Kudos to [@fat](https://github.com/fat).
|
102
|
+
The conventions laid out in the asset files here were based upon those discussed in the article below. Kudos to [@fat](https://github.com/fat).
|
42
103
|
|
43
104
|
https://medium.com/@fat/mediums-css-is-actually-pretty-fucking-good-b8e2a6c78b06
|
44
105
|
|
@@ -7,8 +7,16 @@ module FrontMan
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def inline_svg(filename)
|
10
|
-
|
11
|
-
|
10
|
+
case FrontMan.framework
|
11
|
+
when :rails
|
12
|
+
file_path = "app/assets/images/#{filename}"
|
13
|
+
when :middleman
|
14
|
+
file_path = sitemap.find_resource_by_path(image_path('icons.svg'))
|
15
|
+
.source_file
|
16
|
+
end
|
17
|
+
|
18
|
+
file_contents = File.read(file_path)
|
19
|
+
content_tag :div, file_contents.html_safe, class: 'u-is-hidden'
|
12
20
|
end
|
13
21
|
|
14
22
|
def image_set_tag(filename, options = {})
|
data/front_man.gemspec
CHANGED
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
+
spec.add_dependency 'activesupport'
|
25
|
+
|
24
26
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
25
27
|
spec.add_development_dependency 'guard'
|
26
28
|
spec.add_development_dependency 'guard-rspec'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../../../app/helpers/front_man/images_helper'
|
2
|
+
|
3
|
+
module FrontMan
|
4
|
+
class MiddlemanExtension < Middleman::Extension
|
5
|
+
helpers do
|
6
|
+
include FrontMan::ImagesHelper
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
FrontMan.framework = :middleman
|
11
|
+
end
|
12
|
+
|
13
|
+
::Middleman::Extensions.register(:front_man, FrontMan::MiddlemanExtension)
|
data/lib/front_man/version.rb
CHANGED
data/lib/front_man.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
-
require '
|
1
|
+
require 'active_support'
|
2
2
|
|
3
3
|
module FrontMan
|
4
|
+
mattr_accessor :framework
|
5
|
+
|
4
6
|
def self.root
|
5
7
|
Pathname.new(File.dirname(__dir__))
|
6
8
|
end
|
7
9
|
end
|
10
|
+
|
11
|
+
extension = :railtie if defined?(Rails)
|
12
|
+
extension ||= :middleman if defined?(Middleman)
|
13
|
+
require "front_man/core_ext/#{extension}" if extension
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: front_man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Fonic
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: bundler
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +165,8 @@ files:
|
|
151
165
|
- bin/setup
|
152
166
|
- front_man.gemspec
|
153
167
|
- lib/front_man.rb
|
154
|
-
- lib/front_man/
|
168
|
+
- lib/front_man/core_ext/middleman.rb
|
169
|
+
- lib/front_man/core_ext/railtie.rb
|
155
170
|
- lib/front_man/version.rb
|
156
171
|
homepage: http://dvelp.co.uk/
|
157
172
|
licenses:
|
@@ -178,4 +193,3 @@ signing_key:
|
|
178
193
|
specification_version: 4
|
179
194
|
summary: The DVELP frontend framework.
|
180
195
|
test_files: []
|
181
|
-
has_rdoc:
|