shipyard-framework 0.5.3 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +36 -0
- data/README.md +6 -15
- data/Rakefile +13 -3
- data/app/helpers/shipyard/alert_helper.rb +14 -11
- data/app/helpers/shipyard/icon_helper.rb +9 -3
- data/assets/javascripts/shipyard/alerts.es6 +13 -0
- data/assets/javascripts/shipyard/core.es6 +34 -1
- data/assets/javascripts/shipyard/hamburger.es6 +10 -0
- data/assets/javascripts/shipyard/scroll.es6 +12 -0
- data/assets/javascripts/shipyard.es6 +7 -4
- data/assets/stylesheets/shipyard/_components.sass +1 -0
- data/assets/stylesheets/shipyard/_core.sass +0 -1
- data/assets/stylesheets/shipyard/_utilities.sass +2 -0
- data/assets/stylesheets/shipyard/components/_alerts.sass +4 -0
- data/assets/stylesheets/shipyard/components/_boxes.sass +3 -3
- data/assets/stylesheets/shipyard/components/_buttons.sass +17 -21
- data/assets/stylesheets/shipyard/components/_code.sass +1 -0
- data/assets/stylesheets/shipyard/components/_hamburger.sass +2 -1
- data/assets/stylesheets/shipyard/components/_header.sass +60 -0
- data/assets/stylesheets/shipyard/components/_tables.sass +20 -0
- data/assets/stylesheets/shipyard/core/_typography.sass +1 -0
- data/assets/stylesheets/shipyard/mixins/_box-model.sass +3 -0
- data/assets/stylesheets/shipyard/{core → utilities}/_grid.sass +13 -4
- data/assets/stylesheets/shipyard/utilities/_margin.sass +7 -0
- data/assets/stylesheets/shipyard/utilities/_typography.sass +0 -8
- data/assets/stylesheets/shipyard/variables/_components.scss +12 -0
- data/assets/stylesheets/shipyard/variables/_misc.sass +1 -0
- data/ci/build.rb +5 -0
- data/ci/deploy +31 -0
- data/ci/jekyll +16 -0
- data/ci/percy +5 -6
- data/ci/setup +3 -0
- data/lib/shipyard-framework/icons.rb +18 -28
- data/lib/shipyard-framework/jekyll/hooks.rb +11 -0
- data/lib/shipyard-framework/jekyll/shipyard_css_classes.rb +16 -0
- data/lib/shipyard-framework/jekyll/shipyard_variables.rb +7 -0
- data/lib/shipyard-framework/jekyll/{alert_tag.rb → tags/alert_tag.rb} +2 -2
- data/lib/shipyard-framework/jekyll/{box_tag.rb → tags/box_tag.rb} +1 -1
- data/lib/shipyard-framework/jekyll/{button_tag.rb → tags/button_tag.rb} +1 -1
- data/lib/shipyard-framework/jekyll/tags/icon_tag.rb +20 -0
- data/lib/shipyard-framework/jekyll/{note_tag.rb → tags/note_tag.rb} +1 -1
- data/lib/shipyard-framework/jekyll/{shipyard_version_tag.rb → tags/shipyard_version_tag.rb} +0 -0
- data/lib/shipyard-framework/rails/railtie.rb +8 -4
- data/lib/shipyard-framework/version.rb +1 -1
- data/lib/shipyard-framework.rb +32 -7
- data/shipyard.gemspec +9 -8
- data/spec/helpers/alert_helper_spec.rb +10 -2
- data/spec/helpers/icon_helper_spec.rb +6 -6
- data/styleguide/Gemfile +2 -1
- data/styleguide/Gemfile.lock +38 -10
- data/styleguide/_assets/css/application.sass +9 -0
- data/styleguide/_assets/css/layout.sass +6 -0
- data/styleguide/{_sass → _assets/css}/views.sass +10 -6
- data/styleguide/_assets/js/application.es6 +2 -0
- data/styleguide/_assets/js/views/utilities/colors.es6 +21 -0
- data/styleguide/_config.yml +7 -0
- data/styleguide/_includes/page-heading.html +4 -0
- data/styleguide/_layouts/application.html +26 -9
- data/styleguide/_plugins/icon_item.rb +19 -0
- data/styleguide/components/alerts.md +12 -2
- data/styleguide/components/boxes.md +2 -2
- data/styleguide/components/{buttons.html → buttons.md} +11 -10
- data/styleguide/components/code.html +1 -1
- data/styleguide/components/empty-states.html +2 -2
- data/styleguide/components/forms.html +1 -1
- data/styleguide/components/icons.md +158 -0
- data/styleguide/components/{index.html → index.md} +5 -5
- data/styleguide/components/modals.html +2 -5
- data/styleguide/components/notes.md +2 -2
- data/styleguide/components/tables.md +29 -0
- data/styleguide/components/{tooltips.html → tooltips.md} +4 -7
- data/styleguide/index.md +27 -0
- data/styleguide/utilities/colors.md +25 -0
- data/styleguide/utilities/grid.md +152 -0
- data/styleguide/utilities/{index.html → index.md} +8 -5
- data/styleguide/utilities/{responsive.html → responsive.md} +6 -5
- data/styleguide/utilities/typography.html +1 -1
- metadata +113 -28
- data/assets/javascripts/shipyard/alert.es6 +0 -19
- data/assets/javascripts/shipyard/icon.es6 +0 -50
- data/ci/rspec +0 -1
- data/styleguide/_sass/layout.sass +0 -35
- data/styleguide/assets/css/application.sass +0 -10
- data/styleguide/components/grid.html +0 -44
- data/styleguide/index.html +0 -6
- data/styleguide/utilities/colors.html +0 -41
data/ci/deploy
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e # halt script on error
|
3
|
+
|
4
|
+
echo -e "\n\n************** Git Clone GH-Pages Branch **************"
|
5
|
+
if [[ $CI_NAME = "codeship" ]]
|
6
|
+
then
|
7
|
+
git clone git@github.com:codeship/shipyard.git --branch gh-pages --single-branch styleguide/_site
|
8
|
+
else
|
9
|
+
git clone https://github.com/codeship/shipyard.git --branch gh-pages --single-branch styleguide/_site
|
10
|
+
fi
|
11
|
+
|
12
|
+
echo -e "\n\n************** Jekyll Build **************"
|
13
|
+
cd styleguide
|
14
|
+
JEKYLL_ENV=production bundle exec jekyll build --verbose
|
15
|
+
|
16
|
+
echo -e "\n\n************** Commit & Push to GitHub Pages **************"
|
17
|
+
cd _site
|
18
|
+
git config user.email "${GITHUB_DEPLOY_USER_EMAIL}"
|
19
|
+
git config user.name "${GITHUB_DEPLOY_USER_NAME}"
|
20
|
+
git status
|
21
|
+
git add --all
|
22
|
+
git status
|
23
|
+
|
24
|
+
if [[ $CI_NAME = "codeship" ]]
|
25
|
+
then
|
26
|
+
git commit --allow-empty -m "Deploy to GitHub Pages: ${CI_COMMIT_ID} --skip-ci"
|
27
|
+
git push origin gh-pages
|
28
|
+
else
|
29
|
+
git commit --allow-empty -m "Dry Run Deploy: --skip-ci"
|
30
|
+
git push --dry-run origin gh-pages
|
31
|
+
fi
|
data/ci/jekyll
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e # halt script on error
|
3
|
+
|
4
|
+
echo -e "************** Changed to Styleguide Directory **************"
|
5
|
+
cd ./styleguide
|
6
|
+
pwd
|
7
|
+
|
8
|
+
echo -e "\n\n************** Jekyll Build **************"
|
9
|
+
JEKYLL_ENV=test bundle exec jekyll build --baseurl=''
|
10
|
+
|
11
|
+
echo -e "\n\n************** Change Back to the Root Directory **************"
|
12
|
+
cd ../
|
13
|
+
pwd
|
14
|
+
|
15
|
+
echo -e "\n\n************** HTML Proofer **************"
|
16
|
+
bundle exec htmlproofer ./styleguide/_site --disable-external --allow-hash-href --assume-extension --log-level :debug
|
data/ci/percy
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e # halt script on error
|
3
|
+
|
1
4
|
echo -e "************** Changed to Styleguide Directory **************"
|
2
5
|
cd ./styleguide
|
3
6
|
pwd
|
4
7
|
|
5
|
-
echo -e "\n\n************** Bundle Install **************"
|
6
|
-
gem install bundler --pre
|
7
|
-
bundle install
|
8
|
-
|
9
8
|
echo -e "\n\n************** Jekyll Build **************"
|
10
|
-
bundle exec jekyll build --baseurl=''
|
9
|
+
JEKYLL_ENV=test bundle exec jekyll build --baseurl=''
|
11
10
|
|
12
11
|
echo -e "\n\n************** Changed to Root Directory **************"
|
13
12
|
cd ../
|
14
13
|
pwd
|
15
14
|
|
16
15
|
echo -e "\n\n************** Percy Snapshot **************"
|
17
|
-
bundle exec percy snapshot --widths "375,1280" styleguide/_site/
|
16
|
+
bundle exec percy snapshot --widths "375,768,1280" styleguide/_site/
|
data/ci/setup
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
+
require 'action_view'
|
2
|
+
|
1
3
|
module Shipyard
|
2
4
|
class Icons
|
3
5
|
include ActionView::Helpers::SanitizeHelper
|
4
|
-
include Singleton
|
5
6
|
attr_reader :icons
|
6
7
|
delegate :each, :find, to: :icons
|
7
8
|
delegate :execute_if_updated, :execute, :updated?, to: :updater
|
8
9
|
|
9
|
-
def initialize
|
10
|
-
@path =
|
11
|
-
@public =
|
12
|
-
@
|
10
|
+
def initialize(icon_directory, output_directory, base_path = '')
|
11
|
+
@path = icon_directory
|
12
|
+
@public = output_directory
|
13
|
+
@base_path = base_path
|
13
14
|
reload
|
14
15
|
end
|
15
16
|
|
16
17
|
def reload
|
17
18
|
@icons = load_svgs.freeze
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def find_by(hash)
|
22
|
-
icon = @icons.detect { |i| i[hash.keys.first] == hash.values.first }
|
23
|
-
raise_error(hash.values.first) unless icon
|
24
|
-
icon
|
19
|
+
@icons
|
25
20
|
end
|
26
21
|
|
27
22
|
def base_path
|
28
|
-
|
29
|
-
"/assets/icons-#{@fingerprint}.svg"
|
30
|
-
else
|
31
|
-
'/assets/icons.svg'
|
32
|
-
end
|
23
|
+
"#{@base_path}/assets/icons.svg"
|
33
24
|
end
|
34
25
|
|
35
26
|
def asset_path(svg_id)
|
36
27
|
"#{base_path}##{svg_id}"
|
37
28
|
end
|
38
29
|
|
30
|
+
def write
|
31
|
+
html = []
|
32
|
+
@icons.each do |icon|
|
33
|
+
html << svg_symbol(icon)
|
34
|
+
end
|
35
|
+
FileUtils.mkdir_p(@public) unless File.exists?(@public) || Dir.exists?(@public)
|
36
|
+
File.write("#{@public}/icons.svg", svg_template(html.join))
|
37
|
+
end
|
38
|
+
|
39
39
|
private
|
40
40
|
|
41
41
|
def load_svgs
|
@@ -54,16 +54,6 @@ module Shipyard
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def save_external_svg_defs
|
58
|
-
html = []
|
59
|
-
@icons.each do |icon|
|
60
|
-
html << svg_symbol(icon)
|
61
|
-
end
|
62
|
-
Dir.mkdir(@public) unless File.exists?(@public) || Dir.exists?(@public)
|
63
|
-
File.write("#{@public}/icons.svg", svg_template(html.join))
|
64
|
-
File.write("#{@public}/icons-#{@fingerprint}.svg", svg_template(html.join)) if @fingerprint
|
65
|
-
end
|
66
|
-
|
67
57
|
def sanitize_svg(html)
|
68
58
|
sanitize(html,
|
69
59
|
tags: %w(g circle rect path line polyline polygon ellipse),
|
@@ -71,7 +61,7 @@ module Shipyard
|
|
71
61
|
end
|
72
62
|
|
73
63
|
def svg_symbol(icon)
|
74
|
-
%(<g id="#{icon[:id]}">#{icon[:inner_html]}</g>)
|
64
|
+
%(<g id="#{icon[:id]}" viewBox="#{icon[:view_box]}">#{icon[:inner_html]}</g>)
|
75
65
|
end
|
76
66
|
|
77
67
|
def svg_template(html)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Shipyard
|
2
|
+
module Jekyll
|
3
|
+
class ShipyardCssClasses < Liquid::Tag
|
4
|
+
def initialize(tag_name, params, options)
|
5
|
+
super
|
6
|
+
end
|
7
|
+
|
8
|
+
def render(context)
|
9
|
+
cssClasses = []
|
10
|
+
cssClasses << "env-#{context['site']['env']}"
|
11
|
+
cssClasses << context['page']['path'].tr('/','-').gsub(/[\.][a-z]*/, '')
|
12
|
+
cssClasses.join ' '
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative '../../../../app/helpers/shipyard/alert_helper'
|
2
2
|
|
3
3
|
module Shipyard
|
4
4
|
module Jekyll
|
@@ -7,7 +7,7 @@ module Shipyard
|
|
7
7
|
|
8
8
|
def initialize(tag_name, type, options)
|
9
9
|
super
|
10
|
-
@type = type.tr(':','').to_sym unless type.blank?
|
10
|
+
@type = type.strip.tr(':','').to_sym unless type.blank?
|
11
11
|
end
|
12
12
|
|
13
13
|
def render(context)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative '../../../../app/helpers/shipyard/icon_helper'
|
2
|
+
|
3
|
+
module Shipyard
|
4
|
+
module Jekyll
|
5
|
+
class Icon < Liquid::Tag
|
6
|
+
include Shipyard::IconHelper
|
7
|
+
|
8
|
+
def initialize(tag_name, params, options)
|
9
|
+
super
|
10
|
+
@args = params.strip.split(',')
|
11
|
+
@name = eval(@args[0])
|
12
|
+
@options = @args[1] ? eval("{#{@args[1]}}") : {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def render(context)
|
16
|
+
icon @name, @options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
File without changes
|
@@ -2,10 +2,14 @@ module Shipyard
|
|
2
2
|
module Rails
|
3
3
|
class Railtie < ::Rails::Railtie
|
4
4
|
initializer 'shipyard.reload_cached_icons' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
# TODO: Use rake task or hook into asset pipeline instead?
|
6
|
+
# rake shipyard:icons["#{::Rails.root}/app/assets/icons/", "#{::Rails.root}/public/assets"]
|
7
|
+
$icons = Shipyard::Icons.new(
|
8
|
+
"#{::Rails.root}/app/assets/icons/",
|
9
|
+
"#{::Rails.root}/public/assets"
|
10
|
+
)
|
11
|
+
$icons.write
|
12
|
+
::Rails.application.reloaders << $icons
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
data/lib/shipyard-framework.rb
CHANGED
@@ -8,7 +8,12 @@ module Shipyard
|
|
8
8
|
register_rails_engine
|
9
9
|
elsif sprockets?
|
10
10
|
register_sprockets
|
11
|
-
|
11
|
+
end
|
12
|
+
register_icons
|
13
|
+
load_icons if rspec?
|
14
|
+
|
15
|
+
if jekyll?
|
16
|
+
register_jekyll_hooks
|
12
17
|
register_jekyll_tags
|
13
18
|
end
|
14
19
|
|
@@ -43,6 +48,10 @@ module Shipyard
|
|
43
48
|
defined?(::Sprockets)
|
44
49
|
end
|
45
50
|
|
51
|
+
def rspec?
|
52
|
+
defined?(::RSpec)
|
53
|
+
end
|
54
|
+
|
46
55
|
def rails?
|
47
56
|
defined?(::Rails)
|
48
57
|
end
|
@@ -56,8 +65,11 @@ module Shipyard
|
|
56
65
|
::Sass.load_paths << stylesheets_path
|
57
66
|
end
|
58
67
|
|
59
|
-
def
|
68
|
+
def register_icons
|
60
69
|
require 'shipyard-framework/icons'
|
70
|
+
end
|
71
|
+
|
72
|
+
def register_rails_engine
|
61
73
|
require 'shipyard-framework/rails/engine'
|
62
74
|
require 'shipyard-framework/rails/railtie'
|
63
75
|
end
|
@@ -67,17 +79,26 @@ module Shipyard
|
|
67
79
|
Sprockets.append_path(javascripts_path)
|
68
80
|
end
|
69
81
|
|
82
|
+
def register_jekyll_hooks
|
83
|
+
require 'shipyard-framework/jekyll/hooks'
|
84
|
+
end
|
85
|
+
|
70
86
|
def register_jekyll_tags
|
71
|
-
require 'shipyard-framework/jekyll/
|
72
|
-
require 'shipyard-framework/jekyll/
|
73
|
-
require 'shipyard-framework/jekyll/
|
74
|
-
require 'shipyard-framework/jekyll/
|
75
|
-
require 'shipyard-framework/jekyll/
|
87
|
+
require 'shipyard-framework/jekyll/shipyard_variables'
|
88
|
+
require 'shipyard-framework/jekyll/tags/button_tag'
|
89
|
+
require 'shipyard-framework/jekyll/tags/icon_tag'
|
90
|
+
require 'shipyard-framework/jekyll/tags/box_tag'
|
91
|
+
require 'shipyard-framework/jekyll/tags/note_tag'
|
92
|
+
require 'shipyard-framework/jekyll/tags/alert_tag'
|
93
|
+
require 'shipyard-framework/jekyll/tags/shipyard_version_tag'
|
94
|
+
require 'shipyard-framework/jekyll/shipyard_css_classes'
|
76
95
|
Liquid::Template.register_tag('btn', Shipyard::Jekyll::Button)
|
96
|
+
Liquid::Template.register_tag('icon', Shipyard::Jekyll::Icon)
|
77
97
|
Liquid::Template.register_tag('box', Shipyard::Jekyll::Box)
|
78
98
|
Liquid::Template.register_tag('note', Shipyard::Jekyll::Note)
|
79
99
|
Liquid::Template.register_tag('alert', Shipyard::Jekyll::Alert)
|
80
100
|
Liquid::Template.register_tag('shipyard_version', Shipyard::Jekyll::ShipyardVersion)
|
101
|
+
Liquid::Template.register_tag('shipyard_css_classes', Shipyard::Jekyll::ShipyardCssClasses)
|
81
102
|
end
|
82
103
|
|
83
104
|
def register_helpers
|
@@ -85,6 +106,10 @@ module Shipyard
|
|
85
106
|
require_relative "../#{file}"
|
86
107
|
end
|
87
108
|
end
|
109
|
+
|
110
|
+
def load_icons
|
111
|
+
$icons = Shipyard::Icons.new 'assets/icons/', 'tmp/assets/'
|
112
|
+
end
|
88
113
|
end
|
89
114
|
end
|
90
115
|
|
data/shipyard.gemspec
CHANGED
@@ -5,22 +5,23 @@ require 'shipyard-framework/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'shipyard-framework'
|
7
7
|
spec.version = Shipyard::VERSION
|
8
|
-
spec.authors = ['
|
9
|
-
spec.email = ['
|
8
|
+
spec.authors = ['Codeship']
|
9
|
+
spec.email = ['design@codeship.com']
|
10
10
|
spec.summary = 'A lightweight CSS framework for developing mobile-first projects in Ruby on Rails.'
|
11
|
-
spec.homepage = 'https://github.com/shipyard
|
11
|
+
spec.homepage = 'https://github.com/codeship/shipyard'
|
12
12
|
spec.license = 'MIT'
|
13
13
|
|
14
14
|
# Rails Dependencies
|
15
|
-
# spec.add_runtime_dependency 'sassc-rails', '~> 1.3', '>= 1.3.0'
|
16
|
-
# spec.add_runtime_dependency 'slim-rails', '~> 3.1', '>= 3.1.0'
|
17
|
-
# spec.add_runtime_dependency 'sassc', '~> 1.11.4'
|
18
15
|
spec.add_runtime_dependency 'actionview', '~> 5.0'
|
16
|
+
spec.add_runtime_dependency 'sprockets-es6', '~> 0.9.2'
|
19
17
|
|
20
18
|
spec.add_development_dependency 'bundler', '~> 1.15'
|
21
|
-
spec.add_development_dependency 'sass', '~> 3.5', '>= 3.5.
|
19
|
+
spec.add_development_dependency 'sass', '~> 3.5', '>= 3.5.2'
|
22
20
|
spec.add_development_dependency 'rspec', '~> 3.6'
|
23
|
-
spec.add_development_dependency 'percy-cli', '~> 1.2.9'
|
21
|
+
spec.add_development_dependency 'percy-cli', '~> 1.2', '>= 1.2.9'
|
22
|
+
spec.add_development_dependency 'html-proofer', '~> 3.7', '>= 3.7.4'
|
23
|
+
spec.add_development_dependency 'jekyll', '~> 3.6'
|
24
|
+
spec.add_development_dependency 'jekyll-assets', '~> 2.3'
|
24
25
|
|
25
26
|
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
27
|
spec.files = `git ls-files`.split("\n")
|
@@ -5,15 +5,23 @@ RSpec.describe Shipyard::AlertHelper, type: :helper do
|
|
5
5
|
|
6
6
|
it 'should return a default alert' do
|
7
7
|
expect(flash_alert { 'test' }).to match(
|
8
|
-
%r{<div role="alert"
|
8
|
+
%r{<div role="alert" class="alert"><p class="alert-txt">test</p></div>}
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
xit 'should return a dismissible alert' do
|
13
|
+
expect(flash_alert(:dismissible) { 'test' }).to match(
|
14
|
+
%r{<div role="alert" data-shipyard="alert" class="alert"><p class="alert-txt">test</p></div>}
|
9
15
|
)
|
10
16
|
end
|
11
17
|
|
12
18
|
it 'should return all alert types' do
|
13
19
|
%w(info success warning error).each do |type|
|
14
20
|
expect(flash_alert(type.to_sym) { type }).to match(
|
15
|
-
%r{<div role="alert"
|
21
|
+
%r{<div role="alert" class="alert alert-#{type}"><p class="alert-txt">#{type}</p></div>}
|
16
22
|
)
|
17
23
|
end
|
18
24
|
end
|
25
|
+
|
26
|
+
# TODO: Mock the $icons variable for the helper.
|
19
27
|
end
|
@@ -3,19 +3,19 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe Shipyard::IconHelper, type: :helper do
|
4
4
|
include Shipyard::IconHelper
|
5
5
|
|
6
|
-
|
6
|
+
it 'should return an svg gear icon with the svg use tag.' do
|
7
7
|
expect(icon(:gear)).to match(/<svg class="icon icon-gear icon-outline"(.+?)><use(.+?)>/)
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
expect(icon('gear')).to match(/<svg class="icon icon-gear icon-outline"(.+?)>/)
|
10
|
+
it 'should return an svg gear icon without the svg use tag.' do
|
11
|
+
expect(icon('gear')).to match(/<svg class="icon icon-gear icon-outline"(.+?)><path(.+?)>/)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it 'should return an svg gear icon with a prefixed class name' do
|
15
15
|
expect(icon(:gear, prefix: 'header')).to match(/<svg class="icon icon-gear icon-outline header-icon header-icon-gear" (.+?)><use(.+?)>/)
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
expect(icon(:
|
18
|
+
it 'should return an svg gear icon with a custom CSS class' do
|
19
|
+
expect(icon(:gear, class: 'shipyard-icon')).to match(/<svg class="icon icon-gear icon-outline shipyard-icon" (.+?)><use(.+?)>/)
|
20
20
|
end
|
21
21
|
end
|
data/styleguide/Gemfile
CHANGED
data/styleguide/Gemfile.lock
CHANGED
@@ -3,6 +3,7 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
shipyard-framework (0.5.3)
|
5
5
|
actionview (~> 5.0)
|
6
|
+
sprockets-es6 (~> 0.9.2)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
@@ -18,36 +19,54 @@ GEM
|
|
18
19
|
i18n (~> 0.7)
|
19
20
|
minitest (~> 5.1)
|
20
21
|
tzinfo (~> 1.1)
|
21
|
-
addressable (2.5.
|
22
|
-
public_suffix (
|
22
|
+
addressable (2.5.2)
|
23
|
+
public_suffix (>= 2.0.2, < 4.0)
|
24
|
+
babel-source (5.8.35)
|
25
|
+
babel-transpiler (0.7.0)
|
26
|
+
babel-source (>= 4.0, < 6)
|
27
|
+
execjs (~> 2.0)
|
23
28
|
builder (3.2.3)
|
24
29
|
colorator (1.1.0)
|
25
30
|
concurrent-ruby (1.0.5)
|
31
|
+
crass (1.0.2)
|
26
32
|
erubi (1.6.1)
|
33
|
+
execjs (2.7.0)
|
34
|
+
extras (0.3.0)
|
35
|
+
forwardable-extended (~> 2.5)
|
36
|
+
fastimage (2.1.0)
|
27
37
|
ffi (1.9.18)
|
28
38
|
forwardable-extended (2.6.0)
|
29
39
|
i18n (0.8.6)
|
30
|
-
jekyll (3.
|
40
|
+
jekyll (3.6.0)
|
31
41
|
addressable (~> 2.4)
|
32
42
|
colorator (~> 1.0)
|
33
43
|
jekyll-sass-converter (~> 1.0)
|
34
44
|
jekyll-watch (~> 1.1)
|
35
|
-
kramdown (~> 1.
|
45
|
+
kramdown (~> 1.14)
|
36
46
|
liquid (~> 4.0)
|
37
47
|
mercenary (~> 0.3.3)
|
38
48
|
pathutil (~> 0.9)
|
39
|
-
rouge (
|
49
|
+
rouge (>= 1.7, < 3)
|
40
50
|
safe_yaml (~> 1.0)
|
51
|
+
jekyll-assets (2.3.2)
|
52
|
+
concurrent-ruby (~> 1.0)
|
53
|
+
extras (~> 0.2)
|
54
|
+
fastimage (~> 2.0, >= 1.8)
|
55
|
+
jekyll (~> 3.1, >= 3.0)
|
56
|
+
pathutil (>= 0.8)
|
57
|
+
rack (~> 1.6)
|
58
|
+
sprockets (~> 3.3, < 3.8)
|
41
59
|
jekyll-sass-converter (1.5.0)
|
42
60
|
sass (~> 3.4)
|
43
61
|
jekyll-watch (1.5.0)
|
44
62
|
listen (~> 3.0, < 3.1)
|
45
|
-
kramdown (1.
|
63
|
+
kramdown (1.15.0)
|
46
64
|
liquid (4.0.0)
|
47
65
|
listen (3.0.8)
|
48
66
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
49
67
|
rb-inotify (~> 0.9, >= 0.9.7)
|
50
|
-
loofah (2.
|
68
|
+
loofah (2.1.1)
|
69
|
+
crass (~> 1.0.2)
|
51
70
|
nokogiri (>= 1.5.9)
|
52
71
|
mercenary (0.3.6)
|
53
72
|
mini_portile2 (2.3.0)
|
@@ -56,7 +75,8 @@ GEM
|
|
56
75
|
mini_portile2 (~> 2.3.0)
|
57
76
|
pathutil (0.14.0)
|
58
77
|
forwardable-extended (~> 2.6)
|
59
|
-
public_suffix (
|
78
|
+
public_suffix (3.0.0)
|
79
|
+
rack (1.6.8)
|
60
80
|
rails-dom-testing (2.0.3)
|
61
81
|
activesupport (>= 4.2.0)
|
62
82
|
nokogiri (>= 1.6)
|
@@ -65,13 +85,20 @@ GEM
|
|
65
85
|
rb-fsevent (0.10.2)
|
66
86
|
rb-inotify (0.9.10)
|
67
87
|
ffi (>= 0.5.0, < 2)
|
68
|
-
rouge (
|
88
|
+
rouge (2.2.1)
|
69
89
|
safe_yaml (1.0.4)
|
70
90
|
sass (3.5.1)
|
71
91
|
sass-listen (~> 4.0.0)
|
72
92
|
sass-listen (4.0.0)
|
73
93
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
74
94
|
rb-inotify (~> 0.9, >= 0.9.7)
|
95
|
+
sprockets (3.7.1)
|
96
|
+
concurrent-ruby (~> 1.0)
|
97
|
+
rack (> 1, < 3)
|
98
|
+
sprockets-es6 (0.9.2)
|
99
|
+
babel-source (>= 5.8.11)
|
100
|
+
babel-transpiler
|
101
|
+
sprockets (>= 3.0.0)
|
75
102
|
thread_safe (0.3.6)
|
76
103
|
tzinfo (1.2.3)
|
77
104
|
thread_safe (~> 0.1)
|
@@ -80,7 +107,8 @@ PLATFORMS
|
|
80
107
|
ruby
|
81
108
|
|
82
109
|
DEPENDENCIES
|
83
|
-
jekyll
|
110
|
+
jekyll (~> 3.6.0)
|
111
|
+
jekyll-assets (~> 2.3.2)
|
84
112
|
shipyard-framework!
|
85
113
|
|
86
114
|
BUNDLED WITH
|
@@ -0,0 +1,9 @@
|
|
1
|
+
$font-family: "museo-sans-rounded", "Museo Sans Rounded", Arial, sans-serif
|
2
|
+
$font-monospace: 'Roboto Mono', monospace
|
3
|
+
@import shipyard
|
4
|
+
@import shipyard/components/header
|
5
|
+
@import url('https://use.typekit.net/wel6tpj.css')
|
6
|
+
@import url('https://fonts.googleapis.com/css?family=Roboto+Mono')
|
7
|
+
|
8
|
+
@import layout
|
9
|
+
@import views
|
@@ -1,11 +1,14 @@
|
|
1
|
-
//
|
2
|
-
|
3
|
-
|
4
|
-
margin: 0
|
1
|
+
// Code Styles
|
2
|
+
code
|
3
|
+
li &, p &, h1 &, h2 &, h3 &
|
4
|
+
margin: 0 3px
|
5
5
|
@extend .code-inline
|
6
|
+
div.highlighter-rouge &
|
7
|
+
@extend .code-block
|
8
|
+
margin: 15px 0
|
6
9
|
|
7
10
|
hr
|
8
|
-
margin: 50px 0
|
11
|
+
+respond-to(margin, (x0: 30px 0, x1: 40px 0, x2: 50px 0))
|
9
12
|
|
10
13
|
// Utilities: Colors
|
11
14
|
+component('shade')
|
@@ -21,7 +24,7 @@ hr
|
|
21
24
|
&:not(:last-child)
|
22
25
|
border-right: 10px solid transparent
|
23
26
|
&-box
|
24
|
-
height:
|
27
|
+
height: 165px
|
25
28
|
padding: 5px
|
26
29
|
white-space: nowrap
|
27
30
|
&:hover
|
@@ -41,6 +44,7 @@ hr
|
|
41
44
|
+when('light:hover')
|
42
45
|
color: $gray-darker
|
43
46
|
&-text
|
47
|
+
line-height: 40px
|
44
48
|
transition: 300ms color ease
|
45
49
|
+when('box:hover')
|
46
50
|
color: rgba(#fff,.7)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class ShadeList extends Shipyard {
|
2
|
+
constructor (el) {
|
3
|
+
super(el)
|
4
|
+
|
5
|
+
this.el.forEach((list) => {
|
6
|
+
list.querySelectorAll('[shade-color]').forEach((shade) => {
|
7
|
+
shade.innerHTML = this.rgbToHex(this.css(shade, 'background-color'))
|
8
|
+
})
|
9
|
+
})
|
10
|
+
}
|
11
|
+
|
12
|
+
rgbToHex (rgb) {
|
13
|
+
if (rgb.match(/rgba/)) return '#';
|
14
|
+
let hex = rgb.substr(4, rgb.indexOf(')') - 4).split(',').map(
|
15
|
+
(color) => String('0' + parseInt(color).toString(16)).slice(-2)
|
16
|
+
).join('');
|
17
|
+
return `#${hex}`;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
new ShadeList('[shade-list]')
|