stylus_rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +29 -27
- data/lib/stylus_rails/core_ext.rb +19 -0
- data/lib/stylus_rails/stylus.rb +1 -1
- data/lib/stylus_rails/version.rb +1 -1
- data/lib/stylus_rails.rb +1 -1
- data/stylus_rails.gemspec +2 -2
- metadata +8 -8
- data/lib/stylus_rails/core_ext/attribute_accessors.rb +0 -18
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
### 0.1.1 (2011-03-29)
|
4
|
+
[Compare view](http://github.com/lucasmazza/stylus_rails/compare/v0.1.0...v0.1.1)
|
5
|
+
|
6
|
+
* Isolating the `mattr_accessor` core ext to a module, avoiding conflicts with AS code.
|
7
|
+
|
3
8
|
### 0.1.0 (2011-03-28)
|
4
9
|
[Compare view](http://github.com/lucasmazza/stylus_rails/compare/v0.0.3...v0.1.0)
|
5
10
|
|
data/README.md
CHANGED
@@ -1,42 +1,25 @@
|
|
1
1
|
# Stylus for Rails apps
|
2
2
|
|
3
|
-
A
|
3
|
+
A gem to compile your [Stylus](https://github.com/LearnBoost/stylus) stylesheets in your ruby apps.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
Just add `gem 'stylus_rails'` To your `Gemfile`. Rails will load the Stylus Railtie on your app on the development environment.
|
7
|
+
Just add `gem 'stylus_rails'` To your `Gemfile`. Rails will load the Stylus Railtie on your app on the development environment, and classic Sinatra applications will have an extension registered on your current application. On any other cenario you can run `Stylus.compile` inside your ruby code.
|
8
8
|
|
9
9
|
## Folders
|
10
10
|
|
11
|
-
By default, `stylus_rails` will compile all files
|
11
|
+
By default, `stylus_rails` will compile all files at `public/stylesheets/stylus` to the `public/stylesheets` folder. For instance, `public/stylesheets/stylus/application.styl` would generate `public/stylesheets/application.css`.
|
12
|
+
|
13
|
+
To change this behavior, on Rails apps, you can drop some configurations in an initializer to override the default paths.
|
12
14
|
|
13
15
|
Stylus.root = File.join(Rails.root, 'app')
|
14
16
|
Stylus.directory = 'stylus'
|
15
17
|
Stylus.compile_directory = File.join(Rails.root, 'public', 'stylesheets')
|
16
18
|
|
17
|
-
## Partials
|
18
|
-
|
19
|
-
`stylus_rails` will skip all files starting with `_`, so you can use this naming convention on your partial files and import them on other files.
|
20
|
-
|
21
|
-
So, let's say that you have the following `_vendor.styl`:
|
22
|
-
|
23
|
-
border-radius()
|
24
|
-
-webkit-border-radius arguments
|
25
|
-
-moz-border-radius arguments
|
26
|
-
border-radius arguments
|
27
|
-
|
28
|
-
And a `application.styl`
|
29
|
-
|
30
|
-
@import '_mixins'
|
31
|
-
.button
|
32
|
-
border-radius 5px
|
33
|
-
|
34
|
-
Stylus will compile your `application.styl` into a `application.css` and your `_vendor.styl` will be ignored.
|
35
|
-
|
36
19
|
## Sinatra
|
37
20
|
|
38
|
-
We all love [Sinatra](http://www.sinatrarb.com/), so we have a extension to
|
39
|
-
When using classic applications, just requiring `stylus_rails` will load the extension inside the Sinatra stack. When
|
21
|
+
We all love [Sinatra](http://www.sinatrarb.com/), so we have a extension to your Sinatra applications.
|
22
|
+
When using classic applications, just requiring `stylus_rails` will load the extension inside the Sinatra stack. When going modular, you will need to register it yourself.
|
40
23
|
|
41
24
|
require 'sinatra'
|
42
25
|
require 'stylus_rails'
|
@@ -59,12 +42,31 @@ You can also customize the `root` and `compile_directory` options using the Sina
|
|
59
42
|
|
60
43
|
## Rake task
|
61
44
|
|
62
|
-
`stylus_rails` bundles a rake task `stylus:compile` to recompile your `.styl` files. Just add the following to your Rakefile:
|
45
|
+
`stylus_rails` bundles a rake task `stylus:compile` to recompile your `.styl` files whenever necessary. Just add the following to your Rakefile:
|
63
46
|
|
64
|
-
require '
|
47
|
+
require 'stylus_rails'
|
65
48
|
load 'stylus_rails/tasks/compile.rake'
|
66
49
|
|
67
|
-
|
50
|
+
**NOTE** - *This task is included automatically on Rails apps, so you don't need to do this.*
|
51
|
+
|
52
|
+
## Partials
|
53
|
+
|
54
|
+
`stylus_rails` will skip all files starting with `_`, so you can use this naming convention on your partial files and import them on other files.
|
55
|
+
|
56
|
+
So, let's say that you have the following `_vendor.styl`:
|
57
|
+
|
58
|
+
border-radius()
|
59
|
+
-webkit-border-radius arguments
|
60
|
+
-moz-border-radius arguments
|
61
|
+
border-radius arguments
|
62
|
+
|
63
|
+
And a `application.styl`
|
64
|
+
|
65
|
+
@import '_mixins'
|
66
|
+
.button
|
67
|
+
border-radius 5px
|
68
|
+
|
69
|
+
Stylus will compile your `application.styl` into a `application.css` and your `_vendor.styl` will be ignored.
|
68
70
|
|
69
71
|
## Changelog
|
70
72
|
[here.](https://github.com/lucasmazza/stylus_rails/blob/master/CHANGELOG.md)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Similar implementation to the ActiveSupport core extension.
|
2
|
+
# https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
|
3
|
+
module Stylus
|
4
|
+
module CoreExt
|
5
|
+
def mattr_accessor(sym)
|
6
|
+
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
7
|
+
@@#{sym} = nil unless defined? @@#{sym}
|
8
|
+
|
9
|
+
def self.#{sym}
|
10
|
+
@@#{sym}
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.#{sym}=(obj)
|
14
|
+
@@#{sym} = obj
|
15
|
+
end
|
16
|
+
EOS
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/stylus_rails/stylus.rb
CHANGED
data/lib/stylus_rails/version.rb
CHANGED
data/lib/stylus_rails.rb
CHANGED
data/stylus_rails.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Lucas Mazza"]
|
10
10
|
s.email = ["luc4smazza@gmail.com"]
|
11
11
|
s.homepage = "http://rubygems.org/gems/stylus_rails"
|
12
|
-
s.summary = %q{Stylus stylesheets for
|
13
|
-
s.description = %q{
|
12
|
+
s.summary = %q{Stylus stylesheets for Ruby}
|
13
|
+
s.description = %q{Compiling .styl from your Rails/Sinatra applications}
|
14
14
|
|
15
15
|
s.add_development_dependency "rspec", "~> 2.0"
|
16
16
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stylus_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lucas Mazza
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-29 00:00:00 -03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: "2.0"
|
34
34
|
type: :development
|
35
35
|
version_requirements: *id001
|
36
|
-
description:
|
36
|
+
description: Compiling .styl from your Rails/Sinatra applications
|
37
37
|
email:
|
38
38
|
- luc4smazza@gmail.com
|
39
39
|
executables: []
|
@@ -50,7 +50,7 @@ files:
|
|
50
50
|
- README.md
|
51
51
|
- Rakefile
|
52
52
|
- lib/stylus_rails.rb
|
53
|
-
- lib/stylus_rails/core_ext
|
53
|
+
- lib/stylus_rails/core_ext.rb
|
54
54
|
- lib/stylus_rails/railtie.rb
|
55
55
|
- lib/stylus_rails/runner.rb
|
56
56
|
- lib/stylus_rails/sinatra.rb
|
@@ -100,10 +100,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements: []
|
101
101
|
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 1.
|
103
|
+
rubygems_version: 1.6.1
|
104
104
|
signing_key:
|
105
105
|
specification_version: 3
|
106
|
-
summary: Stylus stylesheets for
|
106
|
+
summary: Stylus stylesheets for Ruby
|
107
107
|
test_files:
|
108
108
|
- spec/fixtures/foo.css
|
109
109
|
- spec/fixtures/output/foo.css
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# Similar implementation to the ActiveSupport core extension.
|
2
|
-
# https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
|
3
|
-
class Module
|
4
|
-
|
5
|
-
def mattr_accessor(sym)
|
6
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
7
|
-
@@#{sym} = nil unless defined? @@#{sym}
|
8
|
-
|
9
|
-
def self.#{sym}
|
10
|
-
@@#{sym}
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.#{sym}=(obj)
|
14
|
-
@@#{sym} = obj
|
15
|
-
end
|
16
|
-
EOS
|
17
|
-
end
|
18
|
-
end
|