stylus 1.0.0.beta → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +17 -7
- data/lib/rails/generators/stylus/assets/assets_generator.rb +4 -4
- data/lib/rails/generators/stylus/assets/templates/stylesheet.css.styl +1 -1
- data/lib/stylus.rb +2 -2
- data/lib/stylus/import_processor.rb +10 -2
- data/lib/stylus/railtie.rb +3 -7
- data/lib/stylus/runtime.rb +7 -8
- data/lib/stylus/sprockets.rb +23 -9
- data/lib/stylus/tilt.rb +2 -54
- data/lib/stylus/tilt/rails.rb +51 -0
- data/lib/stylus/tilt/stylus.rb +52 -0
- data/lib/stylus/version.rb +1 -1
- data/spec/generators/assets_generator_spec.rb +1 -1
- data/spec/generators/controller_generator_spec.rb +2 -2
- data/spec/generators/scaffold_generator_spec.rb +3 -3
- data/spec/import_processor_spec.rb +26 -16
- data/spec/rails_spec.rb +4 -5
- data/spec/runtime_spec.rb +3 -3
- data/spec/sprockets_spec.rb +17 -12
- data/spec/stylus_spec.rb +47 -49
- data/spec/support/generators/test_case.rb +2 -2
- data/spec/support/helpers.rb +6 -1
- data/spec/tilt/rails_spec.rb +64 -0
- data/spec/tilt/stylus_spec.rb +24 -0
- metadata +13 -12
- data/spec/support/generators/tmp/app/controllers/posts_controller.rb +0 -2
- data/spec/support/generators/tmp/app/helpers/posts_helper.rb +0 -2
- data/spec/tilt_spec.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aae79b1819cdb41d494c214ff4dcce6fc309b2b5
|
4
|
+
data.tar.gz: dd62bd41cf976f92c2e6a5a18948e9e306da3f53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2df912f5de8d59046f46cb1c3c2aeb32829f17e145f08bb5f8c70b6da51ce83d0cd0d47ca2c31207d22d33c563bee6a3ebae2df805e91a0cbf29ee7397a5607b
|
7
|
+
data.tar.gz: 04a96508add2597861566cabfe481d7e0f6b953a290cfb89e547bbe0fd9e46370f81a928aab3205a3546446c52772c0d8fb06f425b52b0bd653678102771208e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
### HEAD - 1.0.0
|
2
2
|
|
3
3
|
* Rails 4+ and Ruby 1.9.x/2.0.0 support.
|
4
|
+
* Support for the `asset-path` and `asset-url` mixins, thanks to [@spilin](https://github.com/spilin).
|
4
5
|
|
5
6
|
Please check [0-7-stable](https://github.com/lucasmazza/ruby-stylus/blob/0-7-stable/CHANGELOG.md) for previous changes.
|
data/README.md
CHANGED
@@ -2,10 +2,22 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/lucasmazza/ruby-stylus.png)](http://travis-ci.org/lucasmazza/ruby-stylus)
|
4
4
|
|
5
|
-
`stylus` is a bridge between your Ruby code and the [Stylus](https://github.com/LearnBoost/stylus) library that runs on [node.js](http://nodejs.org). It has support for
|
5
|
+
`stylus` is a bridge between your Ruby code and the [Stylus](https://github.com/LearnBoost/stylus) library that runs on [node.js](http://nodejs.org). It has support for Rails 4 applications. (if you are working with Rails 3, check the [0-7-stable](https://github.com/lucasmazza/ruby-stylus/tree/0-7-stable) branch.)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
+
If you have a `Gemfile`:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem 'stylus'
|
13
|
+
```
|
14
|
+
|
15
|
+
or if you don't have a Gemfile, install it in your system:
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install stylus
|
19
|
+
```
|
20
|
+
|
9
21
|
Since version 0.3.0, the [stylus-source](https://github.com/railsjedi/ruby-stylus-source) packages the Stylus source into a Rubygem, so it will be available after installing this gem. The `ruby-source` version will follow the Stylus releases and their versions.
|
10
22
|
|
11
23
|
You can replace the Stylus code by placing another version of Stylus on `./node_modules/stylus`, and it will be used instead of the version bundled inside the gem.
|
@@ -23,7 +35,7 @@ require 'stylus'
|
|
23
35
|
Stylus.compile(File.new('application.styl')) # returns the compiled stylesheet.
|
24
36
|
|
25
37
|
# Use the :compress option, removing most newlines from the code.
|
26
|
-
Stylus.compile(File.read('application.styl'), :
|
38
|
+
Stylus.compile(File.read('application.styl'), compress: true)
|
27
39
|
|
28
40
|
# Or use the global compress flag
|
29
41
|
Stylus.compress = true
|
@@ -40,9 +52,7 @@ Stylus.use :nib
|
|
40
52
|
# a `:filename` option so Stylus can locate your stylesheet for proper inspection.
|
41
53
|
Stylus.debug = true
|
42
54
|
```
|
43
|
-
### With Rails
|
44
|
-
|
45
|
-
First of all, remember to add `gem 'stylus'` to your Gemfile inside the `:assets` group, So Rails will require the gem according to your current environment - on production you should serve precompiled versions of your assets instead of compiling on the fly.
|
55
|
+
### With Rails and the Asset Pipeline.
|
46
56
|
|
47
57
|
Adding `stylus` to your Gemfile should let you work with `.styl` files with the Rails 3.1 Pipeline. Any asset generated with `rails generate` will be created with a `.css.styl` extension.
|
48
58
|
|
@@ -116,7 +126,7 @@ map('/assets') { run assets.index }
|
|
116
126
|
[Stylus](https://github.com/LearnBoost/stylus) exposes a nice API to create plugins written on [node.js](http://nodejs.org), like [nib](https://github.com/visionmedia/nib). The installation process should be the same as described above for [Stylus](https://github.com/LearnBoost/stylus) (since they're all npm packages after all). You can hook them up on your Ruby code with `Stylus.use`:
|
117
127
|
|
118
128
|
```ruby
|
119
|
-
Stylus.use :fingerprint, :
|
129
|
+
Stylus.use :fingerprint, literal: 'caa8c262e23268d2a7062c6217202343b84f472b'
|
120
130
|
```
|
121
131
|
|
122
132
|
Will run something like this in JavaScript:
|
@@ -138,7 +148,7 @@ For more info about the [Stylus](https://github.com/LearnBoost/stylus) syntax an
|
|
138
148
|
|
139
149
|
(The MIT License)
|
140
150
|
|
141
|
-
Copyright (c) 2012 Lucas Mazza <luc4smazza@gmail.com>
|
151
|
+
Copyright (c) 2012-2013 Lucas Mazza <luc4smazza@gmail.com>
|
142
152
|
|
143
153
|
Permission is hereby granted, free of charge, to any person obtaining
|
144
154
|
a copy of this software and associated documentation files (the
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require 'rails/generators/named_base'
|
2
2
|
|
3
3
|
module Stylus
|
4
4
|
module Generators
|
5
5
|
class AssetsGenerator < ::Rails::Generators::NamedBase
|
6
|
-
source_root File.expand_path(
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
7
|
|
8
8
|
def copy_stylus
|
9
|
-
template
|
9
|
+
template 'stylesheet.css.styl', File.join('app/assets/stylesheets', class_path, "#{file_name}.css.styl")
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
13
|
-
end
|
13
|
+
end
|
data/lib/stylus.rb
CHANGED
@@ -130,13 +130,13 @@ module Stylus
|
|
130
130
|
# Returns the default `Hash` of options:
|
131
131
|
# the compress flag and the global load path.
|
132
132
|
def defaults
|
133
|
-
{ :
|
133
|
+
{ compress: self.compress?, paths: self.paths }
|
134
134
|
end
|
135
135
|
|
136
136
|
# Returns a Hash with the debug options to pass to
|
137
137
|
# Stylus.
|
138
138
|
def debug_options
|
139
|
-
{ :
|
139
|
+
{ linenos: self.debug?, firebug: self.debug? }
|
140
140
|
end
|
141
141
|
|
142
142
|
# Return the gem version alongside with the current `Stylus` version of your system.
|
@@ -22,12 +22,20 @@ module Stylus
|
|
22
22
|
#
|
23
23
|
# Returns the stylesheet content, unmodified.
|
24
24
|
def evaluate(context, locals, &block)
|
25
|
+
return data unless stylus_file?(context)
|
26
|
+
|
25
27
|
depend_on(context, data)
|
26
28
|
data
|
27
29
|
end
|
28
30
|
|
29
31
|
private
|
30
32
|
|
33
|
+
# Internal: Returns true if the file being processed counts as a
|
34
|
+
# Stylus file (That is, it has a .styl extension).
|
35
|
+
def stylus_file?(context)
|
36
|
+
File.fnmatch('*.styl', file) || File.fnmatch('*.styl.*', file)
|
37
|
+
end
|
38
|
+
|
31
39
|
# Internal: Scan the stylesheet body, looking for '@import' calls to
|
32
40
|
# declare them as a dependency on the context using 'depend_on' method.
|
33
41
|
# This method will recursively scans all dependency to ensure that
|
@@ -51,10 +59,10 @@ module Stylus
|
|
51
59
|
#
|
52
60
|
# Returns the resolved 'Asset' or nil if it can't be found.
|
53
61
|
def resolve(context, path)
|
54
|
-
context.resolve(path, :
|
62
|
+
context.resolve(path, content_type: 'text/css')
|
55
63
|
rescue ::Sprockets::FileNotFound
|
56
64
|
begin
|
57
|
-
context.resolve(path + '/index', :
|
65
|
+
context.resolve(path + '/index', content_type: 'text/css')
|
58
66
|
rescue
|
59
67
|
nil
|
60
68
|
end
|
data/lib/stylus/railtie.rb
CHANGED
@@ -3,7 +3,7 @@ require 'stylus/sprockets'
|
|
3
3
|
|
4
4
|
module Stylus
|
5
5
|
# Internal: The Railtie responsible for integrate the Stylus library with
|
6
|
-
# a Rails
|
6
|
+
# a Rails application.
|
7
7
|
#
|
8
8
|
# Some of the customizations of using Stylus alongside Rails:
|
9
9
|
#
|
@@ -24,13 +24,9 @@ module Stylus
|
|
24
24
|
# both Stylus and the Sprockets instance that lives on 'app.assets'. The entire
|
25
25
|
# configuration object will be passed along.
|
26
26
|
#
|
27
|
-
# If you don't have the Asset Pipeline enabled on your application - done by
|
28
|
-
# setting the 'config.assets.enabled' flag to false, this setup process will be
|
29
|
-
# skipped.
|
30
|
-
#
|
31
27
|
# Returns nothing.
|
32
28
|
config.assets.configure do |env|
|
33
|
-
Stylus.setup(env, config.assets)
|
29
|
+
Stylus.setup(env, config.assets.merge(rails: true))
|
34
30
|
end
|
35
31
|
end
|
36
|
-
end
|
32
|
+
end
|
data/lib/stylus/runtime.rb
CHANGED
@@ -8,8 +8,7 @@ module Stylus
|
|
8
8
|
# Internal: Calls a specific function on the Node.JS context.
|
9
9
|
#
|
10
10
|
# Example
|
11
|
-
# exec('version', 2)
|
12
|
-
# # => "2"
|
11
|
+
# exec('version', 2) # => '2'
|
13
12
|
#
|
14
13
|
# Returns The function returned value.
|
15
14
|
def exec(*arguments)
|
@@ -22,8 +21,8 @@ module Stylus
|
|
22
21
|
# if the runtime isn't available. Otherwise, this is a noop.
|
23
22
|
def check_availability!
|
24
23
|
unless runtime.available?
|
25
|
-
message =
|
26
|
-
message <<
|
24
|
+
message = 'The Node.JS runtime is not available to Stylus.'
|
25
|
+
message << 'Ensure that the "node" (or "nodejs") executable is present in your $PATH.'
|
27
26
|
raise RuntimeError, message
|
28
27
|
end
|
29
28
|
end
|
@@ -46,10 +45,10 @@ module Stylus
|
|
46
45
|
# any Node.JS program.
|
47
46
|
def runtime
|
48
47
|
@runtime ||= ExecJS::ExternalRuntime.new(
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
48
|
+
name: 'Node.js (V8)',
|
49
|
+
command: ['nodejs', 'node'],
|
50
|
+
runner_path: File.expand_path('../runtime/runner.js', __FILE__)
|
52
51
|
)
|
53
52
|
end
|
54
53
|
end
|
55
|
-
end
|
54
|
+
end
|
data/lib/stylus/sprockets.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'stylus'
|
2
|
-
require 'stylus/tilt'
|
2
|
+
require 'stylus/tilt/stylus'
|
3
|
+
require 'stylus/tilt/rails'
|
3
4
|
require 'stylus/import_processor'
|
4
5
|
# Public: The setup logic to configure both Stylus and Sprockets on any
|
5
6
|
# kind of application - Rails, Sinatra or Rack.
|
@@ -18,27 +19,40 @@ module Stylus
|
|
18
19
|
#
|
19
20
|
# environment - A instance of Sprockets::Environment.
|
20
21
|
# options - The configuration Hash (default: {})
|
22
|
+
# :rails - a flag to inform that the current application is a Rails app.
|
21
23
|
# :paths - An Array of paths to use the '@import' directive, defaults
|
22
24
|
# to the `paths` attribute on the environment object.
|
23
|
-
#
|
24
|
-
#
|
25
|
+
# :debug - The Boolean value for the debug flag.
|
26
|
+
# :compress - The Boolean value for the debug compress.
|
25
27
|
#
|
26
28
|
# Example
|
27
29
|
#
|
28
30
|
# assets = Sprockets::Environment.new
|
29
|
-
# Stylus.setup(assets, :
|
31
|
+
# Stylus.setup(assets, compress: settings.production?)
|
30
32
|
#
|
31
33
|
# Returns nothing.
|
32
34
|
def self.setup(environment, options = {})
|
33
35
|
paths = options[:paths] || environment.paths
|
34
|
-
directories = paths.select { |dir| dir.to_s =~ /stylesheets$/ }
|
35
36
|
|
36
|
-
Stylus.paths.concat(
|
37
|
+
Stylus.paths.concat(paths)
|
37
38
|
|
38
39
|
Stylus.debug = options.fetch(:debug, Stylus.debug)
|
39
40
|
Stylus.compress = options.fetch(:compress, Stylus.compress)
|
40
|
-
|
41
|
-
environment.register_engine('.styl',
|
41
|
+
template = detect_template_hander(options)
|
42
|
+
environment.register_engine('.styl', template)
|
42
43
|
environment.register_preprocessor('text/css', Stylus::ImportProcessor)
|
43
44
|
end
|
44
|
-
|
45
|
+
|
46
|
+
# Internal: Gets the desired Tilt template handler to the current configuration.
|
47
|
+
# If a 'rails' option is present then the Rails specific template will be
|
48
|
+
# returned instead of the default Stylus Tilt template.
|
49
|
+
#
|
50
|
+
# Returns a Tilt::Template children class.
|
51
|
+
def self.detect_template_hander(options = {})
|
52
|
+
if options[:rails]
|
53
|
+
Stylus::Rails::StylusTemplate
|
54
|
+
else
|
55
|
+
Tilt::StylusTemplate
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/stylus/tilt.rb
CHANGED
@@ -1,54 +1,2 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
#
|
4
|
-
# Examples
|
5
|
-
#
|
6
|
-
# template = Tilt::StylusTemplate.new { |t| File.read('app.styl') }
|
7
|
-
# template.render
|
8
|
-
# # => the compiled CSS from the app.styl file.
|
9
|
-
#
|
10
|
-
# Options should assigned on the template constructor.
|
11
|
-
# template = Tilt::StylusTemplate.new(:compress => true) { |t| File.read('app.styl') }
|
12
|
-
# template.render
|
13
|
-
# # => the compiled CSS with compression enabled.
|
14
|
-
module Tilt
|
15
|
-
class StylusTemplate < Template
|
16
|
-
|
17
|
-
# Public: The default mime type for stylesheets.
|
18
|
-
self.default_mime_type = 'text/css'
|
19
|
-
|
20
|
-
# Internal: Checks if the Stylus module has been properly defined.
|
21
|
-
#
|
22
|
-
# Returns true if the 'Stylus' module is present.
|
23
|
-
def self.engine_initialized?
|
24
|
-
defined? ::Stylus
|
25
|
-
end
|
26
|
-
|
27
|
-
# Internal: Require the 'stylus' file to load the Stylus module.
|
28
|
-
#
|
29
|
-
# Returns nothing.
|
30
|
-
def initialize_engine
|
31
|
-
require_template_library 'stylus'
|
32
|
-
end
|
33
|
-
|
34
|
-
# Internal: Caches the filename as an option entry if it's present.
|
35
|
-
#
|
36
|
-
# Returns nothing.
|
37
|
-
def prepare
|
38
|
-
if self.file
|
39
|
-
options[:filename] ||= self.file
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Internal: Compile the template Stylus using this instance options.
|
44
|
-
# The current 'scope' and given 'locals' are ignored and the output
|
45
|
-
# is cached.
|
46
|
-
#
|
47
|
-
# Returns the compiled stylesheet with CSS syntax.
|
48
|
-
def evaluate(scope, locals, &block)
|
49
|
-
@output ||= Stylus.compile(data, options)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
Tilt.register Tilt::StylusTemplate, 'styl'
|
1
|
+
# require compatibility with older versions.
|
2
|
+
require 'stylus/tilt/stylus'
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'stylus/tilt/stylus'
|
2
|
+
# Public: A Tilt template to compile Stylus stylesheets with asset helpers.
|
3
|
+
module Stylus
|
4
|
+
module Rails
|
5
|
+
class StylusTemplate < ::Tilt::StylusTemplate
|
6
|
+
|
7
|
+
# Public: The default mime type for stylesheets.
|
8
|
+
self.default_mime_type = 'text/css'
|
9
|
+
|
10
|
+
# Internal: Appends stylus mixin for asset_url and asset_path support
|
11
|
+
def evaluate(scope, locals, &block)
|
12
|
+
@data = build_mixin_body(scope) + data
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# Internal: Builds body of a mixin
|
19
|
+
#
|
20
|
+
# Returns string representation of a mixin with asset helper functions
|
21
|
+
def build_mixin_body(scope)
|
22
|
+
@mixin_body ||= if assets_hash(scope).values.all? {|value| value != '' }
|
23
|
+
<<-STYL
|
24
|
+
asset-url(key)
|
25
|
+
return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:url]} ()
|
26
|
+
asset-path(key)
|
27
|
+
return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:path]} ()
|
28
|
+
STYL
|
29
|
+
else
|
30
|
+
''
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Internal: Construct Hash with absolute/relative paths in stylus syntax.
|
35
|
+
#
|
36
|
+
# Returns string representations of hash in Stylus syntax
|
37
|
+
def assets_hash(scope)
|
38
|
+
@assets_hash ||= scope.environment.each_logical_path.each_with_object({ :url => '', :path => '' }) do |logical_path, assets_hash|
|
39
|
+
unless logical_path =~/.*\.(css|js)$/
|
40
|
+
path_to_asset = scope.path_to_asset(logical_path)
|
41
|
+
assets_hash[:url] << "('#{logical_path}' url(\"#{path_to_asset}\")) "
|
42
|
+
assets_hash[:path] << "('#{logical_path}' \"#{path_to_asset}\") "
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Tilt.register ::Stylus::Rails::StylusTemplate, 'styl'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
# Public: A Tilt template to compile Stylus stylesheets.
|
3
|
+
#
|
4
|
+
# Examples
|
5
|
+
#
|
6
|
+
# template = Tilt::StylusTemplate.new { |t| File.read('app.styl') }
|
7
|
+
# template.render # => the compiled CSS from the app.styl file.
|
8
|
+
#
|
9
|
+
# Options should assigned on the template constructor.
|
10
|
+
# template = Tilt::StylusTemplate.new(compress: true) { |t| File.read('app.styl') }
|
11
|
+
# template.render # => the compiled CSS with compression enabled.
|
12
|
+
module Tilt
|
13
|
+
class StylusTemplate < Template
|
14
|
+
|
15
|
+
# Public: The default mime type for stylesheets.
|
16
|
+
self.default_mime_type = 'text/css'
|
17
|
+
|
18
|
+
# Internal: Checks if the Stylus module has been properly defined.
|
19
|
+
#
|
20
|
+
# Returns true if the 'Stylus' module is present.
|
21
|
+
def self.engine_initialized?
|
22
|
+
defined? ::Stylus
|
23
|
+
end
|
24
|
+
|
25
|
+
# Internal: Require the 'stylus' file to load the Stylus module.
|
26
|
+
#
|
27
|
+
# Returns nothing.
|
28
|
+
def initialize_engine
|
29
|
+
require_template_library 'stylus'
|
30
|
+
end
|
31
|
+
|
32
|
+
# Internal: Caches the filename as an option entry if it's present.
|
33
|
+
#
|
34
|
+
# Returns nothing.
|
35
|
+
def prepare
|
36
|
+
if self.file
|
37
|
+
options[:filename] ||= self.file
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Internal: Compile the template Stylus using this instance options.
|
42
|
+
# The current 'scope' and given 'locals' are ignored and the output
|
43
|
+
# is cached.
|
44
|
+
#
|
45
|
+
# Returns a String with the compiled stylesheet with CSS syntax.
|
46
|
+
def evaluate(scope, locals, &block)
|
47
|
+
@output ||= Stylus.compile(data, options)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
Tilt.register Tilt::StylusTemplate, 'styl'
|
data/lib/stylus/version.rb
CHANGED
@@ -7,6 +7,6 @@ describe Rails::Generators::ControllerGenerator do
|
|
7
7
|
arguments %w(posts --stylesheet-engine=stylus)
|
8
8
|
|
9
9
|
it 'generates a .styl file' do
|
10
|
-
file('app/assets/stylesheets/posts.css.styl').
|
10
|
+
expect(file('app/assets/stylesheets/posts.css.styl')).to exist
|
11
11
|
end
|
12
|
-
end
|
12
|
+
end
|
@@ -8,10 +8,10 @@ describe Rails::Generators::ScaffoldGenerator do
|
|
8
8
|
arguments %w(posts --stylesheet-engine=stylus --orm=false)
|
9
9
|
|
10
10
|
it 'generates the default scaffold stylesheet' do
|
11
|
-
file('app/assets/stylesheets/scaffold.css').
|
11
|
+
expect(file('app/assets/stylesheets/scaffold.css')).to exist
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'generates a named .styl file' do
|
15
|
-
file('app/assets/stylesheets/posts.css.styl').
|
15
|
+
expect(file('app/assets/stylesheets/posts.css.styl')).to exist
|
16
16
|
end
|
17
|
-
end
|
17
|
+
end
|
@@ -12,43 +12,53 @@ describe Stylus::ImportProcessor do
|
|
12
12
|
asset = env['import']
|
13
13
|
dependencies = dependencies_on(asset)
|
14
14
|
|
15
|
-
dependencies.
|
15
|
+
expect(dependencies).to include(fixture_path('mixins/vendor'))
|
16
16
|
end
|
17
17
|
|
18
|
-
context
|
18
|
+
context 'nested dependencies' do
|
19
19
|
it 'walks the dependency chain of imported files' do
|
20
20
|
asset = env['nested_import']
|
21
21
|
dependencies = dependencies_on(asset)
|
22
22
|
|
23
|
-
dependencies.
|
24
|
-
dependencies.
|
23
|
+
expect(dependencies).to include(fixture_path('mixins/nested'))
|
24
|
+
expect(dependencies).to include(fixture_path('mixins/vendor'))
|
25
25
|
end
|
26
26
|
|
27
27
|
it "adds files referenced in a directory's index file" do
|
28
28
|
asset = env['indexed_nested_import']
|
29
29
|
dependencies = dependencies_on(asset)
|
30
30
|
|
31
|
-
dependencies.
|
32
|
-
dependencies.
|
33
|
-
dependencies.
|
31
|
+
expect(dependencies).to include(fixture_path('indexed/index'))
|
32
|
+
expect(dependencies).to include(fixture_path('indexed/first_dep'))
|
33
|
+
expect(dependencies).to include(fixture_path('indexed/second_dep'))
|
34
34
|
end
|
35
35
|
|
36
|
-
it
|
36
|
+
it 'walks dependency chains through indexes' do
|
37
37
|
asset = env['indexed_recursive_import']
|
38
38
|
dependencies = dependencies_on(asset)
|
39
39
|
|
40
|
-
dependencies.
|
41
|
-
dependencies.
|
42
|
-
dependencies.
|
43
|
-
dependencies.
|
40
|
+
expect(dependencies).to include(fixture_path('indexed_nested_import'))
|
41
|
+
expect(dependencies).to include(fixture_path('indexed/index'))
|
42
|
+
expect(dependencies).to include(fixture_path('indexed/first_dep'))
|
43
|
+
expect(dependencies).to include(fixture_path('indexed/second_dep'))
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
48
|
-
source =
|
47
|
+
it 'does not process non-stylus files' do
|
48
|
+
source = '@import "nib"'
|
49
|
+
template = Stylus::ImportProcessor.new('stylesheet.scss') { source }
|
50
|
+
context = double
|
51
|
+
|
52
|
+
expect(context).to_not receive(:depend_on)
|
53
|
+
template.render(context)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'swallows errors from files outside the Sprockets paths' do
|
57
|
+
source = '@import "nib"'
|
49
58
|
template = Stylus::ImportProcessor.new { source }
|
50
|
-
sprockets = double
|
51
|
-
sprockets.
|
59
|
+
sprockets = double
|
60
|
+
expect(sprockets).to receive(:resolve).twice.and_raise(::Sprockets::FileNotFound)
|
61
|
+
expect(template).to receive(:stylus_file?).and_return(true)
|
52
62
|
|
53
63
|
expect {
|
54
64
|
template.render(sprockets)
|
data/spec/rails_spec.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'Rails integration' do
|
4
|
-
|
5
|
-
it "copies the folders ending with 'stylesheets' from the Sprockets load path" do
|
4
|
+
it "copies all folders from the Sprockets load path" do
|
6
5
|
app = create_app
|
7
|
-
Stylus.paths.should
|
8
|
-
Stylus.paths.
|
6
|
+
Stylus.paths.should include fixture_root
|
7
|
+
Stylus.paths.should == app.assets.paths
|
9
8
|
end
|
10
9
|
|
11
10
|
it 'process .styl files with the asset pipeline' do
|
@@ -44,4 +43,4 @@ describe 'Rails integration' do
|
|
44
43
|
it 'loads the app normally even when the asset pipeline is disabled' do
|
45
44
|
pending "TODO: supress the sprockets-rails railtie to test this."
|
46
45
|
end
|
47
|
-
end
|
46
|
+
end
|
data/spec/runtime_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Stylus::Runtime do
|
4
|
-
it
|
5
|
-
Stylus.
|
4
|
+
it 'raises an error if the runtime is not available' do
|
5
|
+
allow(Stylus).to receive(:runtime) { double('An unavailable Runtime', available?: false) }
|
6
6
|
|
7
7
|
expect {
|
8
8
|
Stylus.version
|
9
|
-
}.to raise_error RuntimeError, %r[The Node.JS runtime
|
9
|
+
}.to raise_error RuntimeError, %r[The Node.JS runtime is not available to Stylus.]
|
10
10
|
end
|
11
11
|
end
|
data/spec/sprockets_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe 'Sprockets setup' do
|
4
4
|
let(:env) do
|
5
5
|
Sprockets::Environment.new do |assets|
|
6
6
|
assets.append_path fixture_root
|
@@ -8,24 +8,29 @@ describe "Sprockets setup" do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
it
|
12
|
-
env.
|
11
|
+
it 'register the default Tilt template' do
|
12
|
+
expect(env).to receive(:register_engine).with('.styl', Tilt::StylusTemplate)
|
13
13
|
Stylus.setup(env)
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
17
|
-
env.
|
16
|
+
it 'register a Rails specific Tilt template' do
|
17
|
+
expect(env).to receive(:register_engine).with('.styl', Stylus::Rails::StylusTemplate)
|
18
|
+
Stylus.setup(env, rails: true)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'register the import processor' do
|
22
|
+
expect(env).to receive(:register_preprocessor).with('text/css', Stylus::ImportProcessor)
|
18
23
|
Stylus.setup(env)
|
19
24
|
end
|
20
25
|
|
21
|
-
it
|
26
|
+
it 'copies the asset paths' do
|
22
27
|
Stylus.setup(env)
|
23
|
-
Stylus.paths.
|
28
|
+
expect(Stylus.paths).to eq(env.paths)
|
24
29
|
end
|
25
30
|
|
26
|
-
it
|
27
|
-
Stylus.setup(env, :
|
28
|
-
Stylus.debug.
|
29
|
-
Stylus.compress.
|
31
|
+
it 'configure the debug and compress flags' do
|
32
|
+
Stylus.setup(env, debug: true, compress: true)
|
33
|
+
expect(Stylus.debug).to be_true
|
34
|
+
expect(Stylus.compress).to be_true
|
30
35
|
end
|
31
|
-
end
|
36
|
+
end
|
data/spec/stylus_spec.rb
CHANGED
@@ -1,103 +1,101 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Stylus do
|
4
|
-
|
5
|
-
|
6
|
-
input
|
7
|
-
Stylus.compile(input).should == output
|
4
|
+
it 'compiles the given source' do
|
5
|
+
input, output = fixture(:simple)
|
6
|
+
expect(Stylus.compile(input)).to eq(output)
|
8
7
|
end
|
9
8
|
|
10
|
-
it
|
11
|
-
input, output = fixture
|
9
|
+
it 'accepts an IO object' do
|
10
|
+
input, output = fixture(:simple)
|
12
11
|
input = StringIO.new(input)
|
13
|
-
Stylus.compile(input).
|
12
|
+
expect(Stylus.compile(input)).to eq(output)
|
14
13
|
end
|
15
14
|
|
16
|
-
it
|
17
|
-
input, output = fixture
|
18
|
-
Stylus.compile(input, :
|
15
|
+
it 'compress the file when the "compress" flag is given' do
|
16
|
+
input, output = fixture(:compressed)
|
17
|
+
expect(Stylus.compile(input, compress: true)).to eq(output)
|
19
18
|
end
|
20
19
|
|
21
|
-
it
|
20
|
+
it 'handles the compress flag globally' do
|
22
21
|
Stylus.compress = true
|
23
|
-
input, output = fixture
|
24
|
-
Stylus.compile(input).
|
22
|
+
input, output = fixture(:compressed)
|
23
|
+
expect(Stylus.compile(input)).to eq(output)
|
25
24
|
end
|
26
25
|
|
27
|
-
it
|
26
|
+
it 'imports the given paths' do
|
28
27
|
path = fixture_root
|
29
|
-
input, output = fixture
|
30
|
-
Stylus.compile(input, :
|
28
|
+
input, output = fixture(:import)
|
29
|
+
expect(Stylus.compile(input, paths: path)).to eq(output)
|
31
30
|
end
|
32
31
|
|
33
|
-
it
|
32
|
+
it 'handles the import paths globally' do
|
34
33
|
Stylus.paths << fixture_root
|
35
|
-
input, output = fixture
|
36
|
-
Stylus.compile(input).
|
34
|
+
input, output = fixture(:import)
|
35
|
+
expect(Stylus.compile(input)).to eq(output)
|
37
36
|
end
|
38
37
|
|
39
38
|
it 'implicit imports the given paths' do
|
40
39
|
path = File.expand_path('mixins/vendor.styl', fixture_root)
|
41
|
-
input, output = fixture
|
40
|
+
input, output = fixture(:implicit)
|
42
41
|
Stylus.import path
|
43
|
-
Stylus.compile(input).
|
42
|
+
expect(Stylus.compile(input)).to eq(output)
|
44
43
|
end
|
45
44
|
|
46
|
-
it
|
47
|
-
Stylus.version.
|
45
|
+
it 'outputs both gem and library version' do
|
46
|
+
expect(Stylus.version).to match(/Stylus - gem .+ library .+/)
|
48
47
|
end
|
49
48
|
|
50
|
-
it
|
51
|
-
stylus, css = fixture
|
52
|
-
Stylus.convert(css).
|
49
|
+
it 'converts CSS to Stylus' do
|
50
|
+
stylus, css = fixture(:stylesheet)
|
51
|
+
expect(Stylus.convert(css)).to eq(stylus)
|
53
52
|
end
|
54
53
|
|
55
|
-
it
|
56
|
-
Stylus.use :one, :two, :
|
57
|
-
Stylus.
|
54
|
+
it 'stores the given plugins' do
|
55
|
+
Stylus.use :one, :two, argument: true
|
56
|
+
expect(Stylus).to have(2).plugins
|
58
57
|
end
|
59
58
|
|
60
|
-
it
|
59
|
+
it 'includes the given plugins' do
|
61
60
|
Stylus.use :nib
|
62
|
-
input, output = fixture
|
63
|
-
Stylus.compile(input).
|
61
|
+
input, output = fixture(:plugin)
|
62
|
+
expect(Stylus.compile(input)).to eq(output)
|
64
63
|
end
|
65
64
|
|
66
|
-
it
|
65
|
+
it 'includes and imports "nib" automatically' do
|
67
66
|
Stylus.nib = true
|
68
|
-
input, output = fixture
|
69
|
-
Stylus.compile(input).
|
67
|
+
input, output = fixture(:nib)
|
68
|
+
expect(Stylus.compile(input)).to eq(output)
|
70
69
|
end
|
71
70
|
|
72
|
-
it
|
73
|
-
input, output = fixture
|
71
|
+
it 'share variables between imported stylesheets' do
|
72
|
+
input, output = fixture(:variables)
|
74
73
|
path = fixture_root
|
75
74
|
|
76
|
-
Stylus.compile(input, :
|
75
|
+
expect(Stylus.compile(input, paths: path)).to eq(output)
|
77
76
|
end
|
78
77
|
|
79
|
-
describe
|
80
|
-
|
78
|
+
describe 'The debug flag' do
|
81
79
|
let(:path) { fixture_path(:debug) }
|
82
80
|
let(:fixture) { File.read(path) }
|
83
81
|
let(:file) { File.new(path) }
|
84
82
|
|
85
83
|
before { Stylus.debug = true }
|
86
84
|
|
87
|
-
it
|
88
|
-
Stylus.compile(file).
|
85
|
+
it 'turns the "linenos" option on' do
|
86
|
+
expect(Stylus.compile(file)).to match(/line 1 : #{path}/)
|
89
87
|
end
|
90
88
|
|
91
|
-
it
|
92
|
-
Stylus.compile(fixture).
|
89
|
+
it 'skips the "linenos" option if no filename is given' do
|
90
|
+
expect(Stylus.compile(fixture)).to_not match(/line 1 : #{path}/)
|
93
91
|
end
|
94
92
|
|
95
|
-
it
|
96
|
-
Stylus.compile(file).
|
93
|
+
it 'turns the "firebug" option on' do
|
94
|
+
expect(Stylus.compile(file)).to match(/@media -stylus-debug-info/)
|
97
95
|
end
|
98
96
|
|
99
|
-
it
|
100
|
-
Stylus.compile(fixture).
|
97
|
+
it 'skips the "firebug" option if no filename is given' do
|
98
|
+
expect(Stylus.compile(fixture)).to_not match(/@media -stylus-debug-info/)
|
101
99
|
end
|
102
100
|
end
|
103
|
-
end
|
101
|
+
end
|
@@ -23,7 +23,7 @@ module Generators
|
|
23
23
|
run_generator
|
24
24
|
end
|
25
25
|
|
26
|
-
destination File.expand_path(
|
26
|
+
destination File.expand_path('../tmp', __FILE__)
|
27
27
|
end
|
28
28
|
|
29
29
|
module ClassMethods
|
@@ -56,4 +56,4 @@ module Generators
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
-
end
|
59
|
+
end
|
data/spec/support/helpers.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Helpers
|
2
2
|
def create_routes
|
3
|
-
destination = File.join(destination_root,
|
3
|
+
destination = File.join(destination_root, 'config')
|
4
4
|
|
5
5
|
FileUtils.mkdir_p(destination)
|
6
6
|
FileUtils.touch File.join(destination, 'routes.rb')
|
@@ -19,6 +19,7 @@ module Helpers
|
|
19
19
|
config.debug = options[:debug]
|
20
20
|
config.paths << fixture_root
|
21
21
|
config.paths << File.expand_path('javascripts')
|
22
|
+
yield(app) if block_given?
|
22
23
|
|
23
24
|
app.config.eager_load = false
|
24
25
|
app.config.active_support.deprecation = :log
|
@@ -30,6 +31,10 @@ module Helpers
|
|
30
31
|
File.expand_path('../../stylesheets', __FILE__)
|
31
32
|
end
|
32
33
|
|
34
|
+
def images_root
|
35
|
+
File.expand_path('../../images', __FILE__)
|
36
|
+
end
|
37
|
+
|
33
38
|
def output_root
|
34
39
|
File.expand_path('../../cases', __FILE__)
|
35
40
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'stylus/tilt/rails'
|
3
|
+
|
4
|
+
describe Stylus::Rails::StylusTemplate do
|
5
|
+
it 'registers the template for .styl files' do
|
6
|
+
expect(Tilt['application.styl']).to eq(Stylus::Rails::StylusTemplate)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'has a content-type' do
|
10
|
+
expect(Stylus::Rails::StylusTemplate.default_mime_type).to eq('text/css')
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'when no resources other then css found' do
|
14
|
+
it 'compiles the given source without changes' do
|
15
|
+
result = fixture(:simple).last
|
16
|
+
|
17
|
+
app = create_app
|
18
|
+
expect(app.assets['simple'].to_s).to eq(result)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
it 'substitutes asset_path with path' do
|
24
|
+
app = create_app do |app|
|
25
|
+
app.config.assets.paths << images_root
|
26
|
+
app.config.asset_host = 'http://localhost'
|
27
|
+
end
|
28
|
+
result = fixture(:asset_path).last
|
29
|
+
expect(app.assets['asset_path'].to_s).to eq(result)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'substitutes asset_url with url' do
|
33
|
+
app = create_app do |app|
|
34
|
+
app.config.assets.paths << images_root
|
35
|
+
app.config.asset_host = 'http://localhost'
|
36
|
+
end
|
37
|
+
result = fixture(:asset_url).last
|
38
|
+
expect(app.assets['asset_url'].to_s).to eq(result)
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'when config.assets.digest = true' do
|
42
|
+
let(:app) do
|
43
|
+
create_app do |app|
|
44
|
+
app.config.assets.paths << images_root
|
45
|
+
app.config.asset_host = 'http://localhost'
|
46
|
+
app.config.assets.digest = true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'appends fingerprint to asset path' do
|
51
|
+
digested_image_path = app.assets['rails.png'].digest_path
|
52
|
+
expect(digested_image_path).to match(/^rails-(\w+)\.png$/)
|
53
|
+
asset = app.assets['digested_asset_path']
|
54
|
+
expect(asset.to_s).to eq("body {\n background-image: url(\"http://localhost/assets/#{digested_image_path}\");\n}\n")
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'appends fingerprint to asset url' do
|
58
|
+
digested_image_path = app.assets['rails.png'].digest_path
|
59
|
+
expect(digested_image_path).to match(/^rails-(\w+)\.png$/)
|
60
|
+
asset = app.assets['digested_asset_url']
|
61
|
+
expect(asset.to_s).to eq("body {\n background-image: url(\"http://localhost/assets/#{digested_image_path}\");\n}\n")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'stylus/tilt/stylus'
|
3
|
+
|
4
|
+
describe Tilt::StylusTemplate do
|
5
|
+
it 'registers the template for .styl files' do
|
6
|
+
expect(Tilt['application.styl']).to eq(Stylus::Rails::StylusTemplate)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'has a content-type' do
|
10
|
+
expect(Tilt::StylusTemplate.default_mime_type).to eq('text/css')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'compiles the given source' do
|
14
|
+
input, output = fixture(:simple)
|
15
|
+
template = Tilt::StylusTemplate.new { |_| input }
|
16
|
+
expect(template.render).to eq(output)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'compiles with the compress option' do
|
20
|
+
input, output = fixture(:compressed)
|
21
|
+
template = Tilt::StylusTemplate.new(compress: true) { |_| input }
|
22
|
+
expect(template.render).to eq(output)
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stylus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Mazza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -57,6 +57,8 @@ files:
|
|
57
57
|
- lib/stylus/runtime/runner.js
|
58
58
|
- lib/stylus/runtime.rb
|
59
59
|
- lib/stylus/sprockets.rb
|
60
|
+
- lib/stylus/tilt/rails.rb
|
61
|
+
- lib/stylus/tilt/stylus.rb
|
60
62
|
- lib/stylus/tilt.rb
|
61
63
|
- lib/stylus/version.rb
|
62
64
|
- lib/stylus.rb
|
@@ -70,14 +72,14 @@ files:
|
|
70
72
|
- spec/sprockets_spec.rb
|
71
73
|
- spec/stylus_spec.rb
|
72
74
|
- spec/support/generators/test_case.rb
|
73
|
-
- spec/support/generators/tmp/app/controllers/posts_controller.rb
|
74
|
-
- spec/support/generators/tmp/app/helpers/posts_helper.rb
|
75
75
|
- spec/support/generators/tmp/config/routes.rb
|
76
76
|
- spec/support/helpers.rb
|
77
77
|
- spec/support/matchers.rb
|
78
|
-
- spec/
|
78
|
+
- spec/tilt/rails_spec.rb
|
79
|
+
- spec/tilt/stylus_spec.rb
|
79
80
|
homepage: https://github.com/lucasmazza/ruby-stylus
|
80
|
-
licenses:
|
81
|
+
licenses:
|
82
|
+
- MIT
|
81
83
|
metadata: {}
|
82
84
|
post_install_message:
|
83
85
|
rdoc_options: []
|
@@ -90,12 +92,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
92
|
version: '0'
|
91
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
94
|
requirements:
|
93
|
-
- - '
|
95
|
+
- - '>='
|
94
96
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
97
|
+
version: '0'
|
96
98
|
requirements: []
|
97
99
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.0.
|
100
|
+
rubygems_version: 2.0.3
|
99
101
|
signing_key:
|
100
102
|
specification_version: 4
|
101
103
|
summary: Ruby Stylus Compiler
|
@@ -110,9 +112,8 @@ test_files:
|
|
110
112
|
- spec/sprockets_spec.rb
|
111
113
|
- spec/stylus_spec.rb
|
112
114
|
- spec/support/generators/test_case.rb
|
113
|
-
- spec/support/generators/tmp/app/controllers/posts_controller.rb
|
114
|
-
- spec/support/generators/tmp/app/helpers/posts_helper.rb
|
115
115
|
- spec/support/generators/tmp/config/routes.rb
|
116
116
|
- spec/support/helpers.rb
|
117
117
|
- spec/support/matchers.rb
|
118
|
-
- spec/
|
118
|
+
- spec/tilt/rails_spec.rb
|
119
|
+
- spec/tilt/stylus_spec.rb
|
data/spec/tilt_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'stylus/tilt'
|
3
|
-
|
4
|
-
describe Tilt::StylusTemplate do
|
5
|
-
|
6
|
-
it "registers the template for .styl files" do
|
7
|
-
Tilt['application.styl'].should == Tilt::StylusTemplate
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has a content-type" do
|
11
|
-
Tilt::StylusTemplate.default_mime_type.should == 'text/css'
|
12
|
-
end
|
13
|
-
|
14
|
-
it "compiles the given source" do
|
15
|
-
input, output = fixture :simple
|
16
|
-
template = Tilt::StylusTemplate.new { |t| input }
|
17
|
-
template.render.should == output
|
18
|
-
end
|
19
|
-
|
20
|
-
it "compiles with the compress option" do
|
21
|
-
input, output = fixture :compressed
|
22
|
-
template = Tilt::StylusTemplate.new(:compress => true) { |t| input }
|
23
|
-
template.render.should == output
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|