stylist 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +31 -16
- data/lib/stylist/processors/sass_processor.rb +6 -2
- data/lib/stylist/version.rb +1 -1
- data/stylist.gemspec +4 -4
- metadata +13 -4
data/README.md
CHANGED
@@ -2,19 +2,34 @@ Stylist
|
|
2
2
|
=======
|
3
3
|
|
4
4
|
|
5
|
-
____ __ ___ __
|
6
|
-
/\ _`\ /\ \__ /\_ \ __ /\ \
|
7
|
-
\ \,\L\_\ \ ,_\ __ __\//\ \ /\_\ ____\ \ \
|
8
|
-
\/_\__ \\ \ \/ /\ \/\ \ \ \ \ \/\ \ /',__\\ \
|
9
|
-
/\ \L\ \ \ \_\ \ \_\ \ \_\ \_\ \ \/\__, `\\ \ \
|
10
|
-
\ `\____\ \__\\/`____ \/\____\\ \_\/\____/ \ \
|
11
|
-
\/_____/\/__/ `/___/> \/____/ \/_/\/___/ \/
|
12
|
-
/\___/
|
5
|
+
____ __ ___ __
|
6
|
+
/\ _`\ /\ \__ /\_ \ __ /\ \__
|
7
|
+
\ \,\L\_\ \ ,_\ __ __\//\ \ /\_\ ____\ \ ,_\
|
8
|
+
\/_\__ \\ \ \/ /\ \/\ \ \ \ \ \/\ \ /',__\\ \ \/
|
9
|
+
/\ \L\ \ \ \_\ \ \_\ \ \_\ \_\ \ \/\__, `\\ \ \_
|
10
|
+
\ `\____\ \__\\/`____ \/\____\\ \_\/\____/ \ \__\
|
11
|
+
\/_____/\/__/ `/___/> \/____/ \/_/\/___/ \/__/
|
12
|
+
/\___/
|
13
13
|
\/__/
|
14
14
|
|
15
15
|
|
16
16
|
_Stylist_ provides powerful stylesheet management for your Rails app. You can organize your .css files by media, add, remove or prepend stylesheets in the stylesheets stack from your controllers and views, and process them using [Less](http://lesscss.org) or [Sass](http://sass-lang.com/). And as if that wasn't awesome enough, you can even minify them using [YUI Compressor](http://developer.yahoo.com/yui/compressor) and bundle them into completely incomprehensible, but bandwidth-friendly mega-stylesheets.
|
17
17
|
|
18
|
+
What Stylist Does
|
19
|
+
=======
|
20
|
+
|
21
|
+
It lets you do cool stuff with your css files. Say you want to process stylesheets with [Less](http://lesscss.org), and then minify them with [YUI Compressor](http://developer.yahoo.com/yui/compressor). You'll put this in `config/initializers/stylist.rb`:
|
22
|
+
|
23
|
+
Stylist.configure do |config|
|
24
|
+
config.process_with :less, :yui_compressor
|
25
|
+
end
|
26
|
+
|
27
|
+
Then, you can do all kind of css file gymnastics, using the almighty `css` helper.
|
28
|
+
|
29
|
+
<% css.append(:base).prepend(:awesome_framework).remove('some_stylesheet', :media => :print) %>
|
30
|
+
|
31
|
+
This will add all stylesheets from the `:base` expansion, make those from `:awesome_framework` load first, then get rid of `some_stylesheet.css` from the print stylesheets, which won't be needed anymore. In one line. Read on to find out more.
|
32
|
+
|
18
33
|
Install
|
19
34
|
=======
|
20
35
|
|
@@ -71,17 +86,17 @@ Examples
|
|
71
86
|
|
72
87
|
These can be written either in your views inside `<% %>` tags, or directly in your controller actions or filters. Every method accepts a `:media => :type` argument to specify what stylesheet stack should be manipulated. When omitted, the default media stack is used.
|
73
88
|
|
74
|
-
*
|
75
|
-
|
89
|
+
* `css 'list_view', 'foo_details'`
|
90
|
+
Adds `list_view.css` and `foo_details.css` to the stack.
|
76
91
|
|
77
|
-
*
|
78
|
-
|
92
|
+
* `css.remove('grid').prepend('grid_iphone').append('mobile')`
|
93
|
+
Removes `grid.css`, prepends `grid_iphone.css` to the front of the stack and then appends `mobile.css` to the end.
|
79
94
|
|
80
|
-
*
|
81
|
-
|
95
|
+
* `css '-grid', 'grid_iphone+', 'mobile'`
|
96
|
+
The short, ninja version of the above example.
|
82
97
|
|
83
|
-
*
|
84
|
-
|
98
|
+
* `css :print, :media => :print`
|
99
|
+
Adds the stylesheets, registered in the `:print` stylesheet expansion group, to the print media stack.
|
85
100
|
|
86
101
|
Working with Less/Sass
|
87
102
|
-------
|
@@ -12,7 +12,7 @@ module Stylist
|
|
12
12
|
source_path = source_path_for(stylesheet)
|
13
13
|
if source_path && source_path.exist?
|
14
14
|
puts "Processing #{source_path}..."
|
15
|
-
engine = File.open(source_path) {|f| ::Sass::Engine.new(f.read) }
|
15
|
+
engine = File.open(source_path) {|f| ::Sass::Engine.new(f.read, :syntax => syntax_from_source_path(source_path)) }
|
16
16
|
css = engine.to_css
|
17
17
|
css.delete!("\n") if configuration.sass.compress
|
18
18
|
File.open(stylesheet, "w") { |f| f.puts css }
|
@@ -21,7 +21,11 @@ module Stylist
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def source_path_for(file)
|
24
|
-
Pathname.glob(File.join(configuration.sass.source_path, File.basename(file, '.css')+'.
|
24
|
+
Pathname.glob(File.join(configuration.sass.source_path, File.basename(file, '.css')+'.s[ac]ss'))[0]
|
25
|
+
end
|
26
|
+
|
27
|
+
def syntax_from_source_path(path)
|
28
|
+
path.to_s.ends_with?('.scss') ? :scss : :sass
|
25
29
|
end
|
26
30
|
|
27
31
|
def stylesheets_to_process(collection)
|
data/lib/stylist/version.rb
CHANGED
data/stylist.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{stylist}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tisho Georgiev"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-24}
|
13
13
|
s.description = %q{Stylist provides powerful stylesheet management for your Rails app. You can organize your CSS files by media, add, remove or prepend stylesheets in the stylesheets stack from your controllers and views, and process them using Less or Sass. And as if that wasn't awesome enough, you can even minify them using YUI Compressor and bundle them into completely incomprehensible, but bandwidth-friendly mega-stylesheets.}
|
14
14
|
s.email = %q{tihomir.georgiev@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -53,7 +53,7 @@ Gem::Specification.new do |s|
|
|
53
53
|
s.homepage = %q{http://github.com/tisho/stylist}
|
54
54
|
s.rdoc_options = ["--charset=UTF-8"]
|
55
55
|
s.require_paths = ["lib"]
|
56
|
-
s.rubygems_version = %q{1.3.
|
56
|
+
s.rubygems_version = %q{1.3.7}
|
57
57
|
s.summary = %q{Powerful stylesheet management for your Rails app.}
|
58
58
|
s.test_files = [
|
59
59
|
"spec/configuration_spec.rb",
|
@@ -70,7 +70,7 @@ Gem::Specification.new do |s|
|
|
70
70
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
71
71
|
s.specification_version = 3
|
72
72
|
|
73
|
-
if Gem::Version.new(Gem::
|
73
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
74
74
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
75
75
|
s.add_development_dependency(%q<rails>, [">= 2.3"])
|
76
76
|
else
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stylist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Tisho Georgiev
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-10-24 00:00:00 +03:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: rspec
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 2
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: rails
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 5
|
41
46
|
segments:
|
42
47
|
- 2
|
43
48
|
- 3
|
@@ -96,23 +101,27 @@ rdoc_options:
|
|
96
101
|
require_paths:
|
97
102
|
- lib
|
98
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
99
105
|
requirements:
|
100
106
|
- - ">="
|
101
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
102
109
|
segments:
|
103
110
|
- 0
|
104
111
|
version: "0"
|
105
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
106
114
|
requirements:
|
107
115
|
- - ">="
|
108
116
|
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
109
118
|
segments:
|
110
119
|
- 0
|
111
120
|
version: "0"
|
112
121
|
requirements: []
|
113
122
|
|
114
123
|
rubyforge_project:
|
115
|
-
rubygems_version: 1.3.
|
124
|
+
rubygems_version: 1.3.7
|
116
125
|
signing_key:
|
117
126
|
specification_version: 3
|
118
127
|
summary: Powerful stylesheet management for your Rails app.
|