styleguide_rails 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -5
- data/lib/generators/styleguide/install/USAGE +1 -1
- data/lib/generators/styleguide/install/install_generator.rb +3 -3
- data/lib/generators/styleguide/install/templates/Guardfile +5 -0
- data/lib/generators/styleguide/install/templates/styleguide.html.erb +1 -1
- data/lib/generators/styleguide/widget/templates/widget.html.haml +1 -0
- data/lib/generators/styleguide/widget/templates/widget.html.slim +1 -0
- data/lib/generators/styleguide/widget/widget_generator.rb +7 -1
- data/lib/styleguide_rails/version.rb +1 -1
- data/styleguide_rails.gemspec +3 -1
- metadata +39 -5
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
<img src="illustration/logo.png" alt="Styleguide Rails Logo" align="right" />
|
2
2
|
|
3
3
|
Adds a [living style
|
4
4
|
guide](http://24ways.org/2011/front-end-style-guides/) to your Rails
|
@@ -32,7 +32,7 @@ Add this gem to your Rails Gemfile:
|
|
32
32
|
|
33
33
|
Run `bundle`, and execute the styleguide generator:
|
34
34
|
|
35
|
-
|
35
|
+
rails generate styleguide:install
|
36
36
|
|
37
37
|
That's it, you're done, you have a styleguide available at
|
38
38
|
`http://yourapp.com/styleguide`. If you visit that path you'll see there
|
@@ -44,12 +44,26 @@ is an example widget already created:
|
|
44
44
|
|
45
45
|
To add a new widget, run
|
46
46
|
|
47
|
-
|
47
|
+
rails generate styleguide:widget NAME
|
48
48
|
|
49
49
|
which will create a partial in `app/views/styleguide/widgets` and it
|
50
50
|
will appear in the style guide. These partials support templating
|
51
51
|
languages like Haml if you have the gems installed.
|
52
52
|
|
53
|
+
## Live Reloading
|
54
|
+
|
55
|
+
Styleguide Rails can reload your browser whenever you change a CSS file
|
56
|
+
or a widget. This instant feedback is helpful for adjusting the styles.
|
57
|
+
To enable live reloading,
|
58
|
+
|
59
|
+
* Install the [LiveReload](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei?hl=en)
|
60
|
+
plugin for Google Chrome.
|
61
|
+
* Add `gem 'guard'` to your `Gemfile`
|
62
|
+
* Run `bundle`
|
63
|
+
* Run `guard` in a new terminal window
|
64
|
+
* Be sure you enable the LiveReload plugin in Chrome. Just click its
|
65
|
+
icon.
|
66
|
+
|
53
67
|
## Credits
|
54
68
|
|
55
69
|
Thanks to project
|
@@ -61,8 +75,8 @@ idea for this gem.
|
|
61
75
|
|
62
76
|
To overwrite an installation of an earlier version, run
|
63
77
|
|
64
|
-
|
65
|
-
|
78
|
+
bundle update --source styleguide_rails
|
79
|
+
rails generate styleguide:install -f
|
66
80
|
|
67
81
|
Don't worry, this will preserve any existing widgets.
|
68
82
|
|
@@ -10,7 +10,7 @@ module Styleguide
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def create_route
|
13
|
-
route "
|
13
|
+
route "get 'styleguide' => 'styleguide#index' if Rails.env.development?"
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_views
|
@@ -34,8 +34,8 @@ module Styleguide
|
|
34
34
|
copy_file '_example_elements.html', 'app/views/styleguide/widgets/_example_elements.html'
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
38
|
-
|
37
|
+
def enable_guard_reloading
|
38
|
+
copy_file 'Guardfile', 'Guardfile'
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<title>Application Style Guide</title>
|
5
5
|
<%= stylesheet_link_tag "application", :media => "all" %>
|
6
6
|
<%= javascript_include_tag "application" %>
|
7
|
-
<meta name="viewport" content="width=device-width
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
8
8
|
|
9
9
|
<!-- Bypass asset pipeline to protect other pages -->
|
10
10
|
<script src="/javascripts/styleguide.js" type="text/javascript"></script>
|
@@ -0,0 +1 @@
|
|
1
|
+
%p Your new widget
|
@@ -0,0 +1 @@
|
|
1
|
+
p Your new widget
|
@@ -9,8 +9,14 @@ module Styleguide
|
|
9
9
|
desc "Creates a widget in your styleguide"
|
10
10
|
|
11
11
|
def create_widget
|
12
|
+
supported_template_engines = [:haml, :erb, :slim]
|
12
13
|
destination_name = name.gsub(/-/, '_').parameterize(sep = '_')
|
13
|
-
|
14
|
+
template_engine = Rails.configuration.generators.options[:rails][:template_engine]
|
15
|
+
|
16
|
+
# use erb if we don't have a template for the engine currently in use
|
17
|
+
template_engine = :erb if !supported_template_engines.include? template_engine
|
18
|
+
|
19
|
+
copy_file "widget.html.#{template_engine}", "app/views/styleguide/widgets/_#{destination_name}.html.#{template_engine}"
|
14
20
|
end
|
15
21
|
end
|
16
22
|
end
|
data/styleguide_rails.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'styleguide_rails/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "styleguide_rails"
|
8
8
|
gem.version = StyleguideRails::VERSION
|
9
|
-
gem.
|
9
|
+
gem.author = "Joe Nelson"
|
10
10
|
gem.email = ["cred+github@begriffs.com"]
|
11
11
|
gem.description = %q{Add living CSS styleguide to your Rails project}
|
12
12
|
gem.summary = %q{Generates a controller, route, and views for your styleguide}
|
@@ -18,4 +18,6 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
20
|
gem.add_dependency "rails", ">= 3.0.0"
|
21
|
+
gem.add_dependency "rb-readline"
|
22
|
+
gem.add_dependency "guard-livereload", "~> 1.4.0"
|
21
23
|
end
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: styleguide_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Joe Nelson
|
9
|
-
- Adam Braus
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rails
|
@@ -28,6 +27,38 @@ dependencies:
|
|
28
27
|
- - ! '>='
|
29
28
|
- !ruby/object:Gem::Version
|
30
29
|
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rb-readline
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: guard-livereload
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.4.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.4.0
|
31
62
|
description: Add living CSS styleguide to your Rails project
|
32
63
|
email:
|
33
64
|
- cred+github@begriffs.com
|
@@ -44,6 +75,7 @@ files:
|
|
44
75
|
- illustration/screenshot.png
|
45
76
|
- lib/generators/styleguide/install/USAGE
|
46
77
|
- lib/generators/styleguide/install/install_generator.rb
|
78
|
+
- lib/generators/styleguide/install/templates/Guardfile
|
47
79
|
- lib/generators/styleguide/install/templates/_example_elements.html
|
48
80
|
- lib/generators/styleguide/install/templates/_widget.html.erb
|
49
81
|
- lib/generators/styleguide/install/templates/_widget_link.html.erb
|
@@ -53,6 +85,8 @@ files:
|
|
53
85
|
- lib/generators/styleguide/install/templates/styleguide.js
|
54
86
|
- lib/generators/styleguide/install/templates/styleguide_controller.rb
|
55
87
|
- lib/generators/styleguide/widget/templates/widget.html.erb
|
88
|
+
- lib/generators/styleguide/widget/templates/widget.html.haml
|
89
|
+
- lib/generators/styleguide/widget/templates/widget.html.slim
|
56
90
|
- lib/generators/styleguide/widget/widget_generator.rb
|
57
91
|
- lib/styleguide_rails.rb
|
58
92
|
- lib/styleguide_rails/version.rb
|
@@ -71,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
105
|
version: '0'
|
72
106
|
segments:
|
73
107
|
- 0
|
74
|
-
hash: -
|
108
|
+
hash: -456976210801234736
|
75
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
110
|
none: false
|
77
111
|
requirements:
|
@@ -80,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
114
|
version: '0'
|
81
115
|
segments:
|
82
116
|
- 0
|
83
|
-
hash: -
|
117
|
+
hash: -456976210801234736
|
84
118
|
requirements: []
|
85
119
|
rubyforge_project:
|
86
120
|
rubygems_version: 1.8.25
|