epuber-stylus 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4fe8b935a89a5c33ed76565781f7ee79447753a
4
- data.tar.gz: 61bdd3e96d0aa491d0bb07dd0333e89fcfa991f1
3
+ metadata.gz: a36c30861dca914050c7e62b6e293db9b99a9e2b
4
+ data.tar.gz: 67fff6fb9fba3b88290445afc222b08dac2b0605
5
5
  SHA512:
6
- metadata.gz: dd5c1ab079de3c7ab1ce14806520ef2c82cb91352cd20b5b6972631e10f73e4fcf9a0dd205f6a4b6b48fbfc17e8293939521b92422094e0a0d570d3c37c888fe
7
- data.tar.gz: 13ada496cfb38974a8cca74302fa8d093ca25796a581c893ca6ceb4296f98dcec531d62555cedf2dafc98c46a0215fad4f452cdcbfd1ac94bdc5f7cb7e380df6
6
+ metadata.gz: 5c705728b1cee368a02f31b0e2399f39861417e1a116b3796e88e18149360381f9143a5f09c7fee3c51a904ce413d185175675de3d20396640bf75e9cef7e31f
7
+ data.tar.gz: d4c3b1a586a1acfc51845a28709c590342e67a1e3eb21a003f8222f900ebeb4d5d2b331c9031194cbe3405f6ee0f73f4bc9e7997ec55b2f2582c1ca9caa4d0b2
@@ -1,3 +1,12 @@
1
+ ### 1.1.1
2
+
3
+ * Add support for `Stylus.define` with Hash value. Symbols are automatically converted into strings, so you can use them
4
+ for keys in hash.
5
+
6
+ ### 1.1.0
7
+
8
+ * Add support for `Stylus.define` which lets you define custom variables into template.
9
+
1
10
  ### 1.0.1
2
11
 
3
12
  * Prevent exceptions from files without extensions.
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Ruby Stylus
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/stylus.svg)](http://badge.fury.io/rb/stylus)
4
- [![Build Status](https://travis-ci.org/forgecrafted/ruby-stylus.svg?branch=master)](https://travis-ci.org/forgecrafted/ruby-stylus)
5
- [![Coverage Status](https://coveralls.io/repos/forgecrafted/ruby-stylus/badge.svg)](https://coveralls.io/r/forgecrafted/ruby-stylus)
3
+ [![Gem Version](https://badge.fury.io/rb/epuber-stylus.svg)](http://badge.fury.io/rb/epuber-stylus)
4
+ [![Build Status](https://travis-ci.org/epuber-io/ruby-stylus.svg?branch=master)](https://travis-ci.org/epuber-io/ruby-stylus)
5
+ [![Coverage Status](https://coveralls.io/repos/epuber-io/ruby-stylus/badge.svg)](https://coveralls.io/r/epuber-io/ruby-stylus)
6
6
 
7
7
  `stylus` is a bridge between Ruby and the [Stylus](https://github.com/stylus/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/forgecrafted/ruby-stylus/tree/0-7-stable) branch.)
8
8
 
@@ -11,13 +11,13 @@
11
11
  If you have a `Gemfile`:
12
12
 
13
13
  ```
14
- gem 'stylus'
14
+ gem 'epuber-stylus'
15
15
  ```
16
16
 
17
17
  or install it on your system:
18
18
 
19
19
  ```
20
- gem install stylus
20
+ gem install epuber-stylus
21
21
  ```
22
22
 
23
23
  The [ruby-stylus-source](https://github.com/forgecrafted/ruby-stylus-source) packages the Stylus source into a gem, and is installed as a dependency of this gem. Versions of `ruby-stylus-source` follow Stylus releases and their versions.
@@ -31,7 +31,7 @@ You can manually replace the Stylus code by placing another version of Stylus on
31
31
  The interaction is done by the `Stylus` module. You can compile Stylus syntax to CSS, convert it back, enable plugins and tweak some other options:
32
32
 
33
33
  ```ruby
34
- require 'stylus'
34
+ require 'epuber-stylus'
35
35
 
36
36
  # Accepts a raw string or an IO object (File, StringIO or anything that responds to 'read').
37
37
  Stylus.compile(File.new('application.styl')) # returns the compiled stylesheet.
@@ -137,7 +137,7 @@ stylus(file).use(fingerprint({literal:'caa8c262e23268d2a7062c6217202343b84f472b'
137
137
 
138
138
  ## Questions, Bugs or Support
139
139
 
140
- [Drop us a line in the issues section](https://github.com/forgecrafted/ruby-stylus/issues).
140
+ [Drop us a line in the issues section](https://github.com/epuber-io/ruby-stylus/issues).
141
141
 
142
142
  **Be sure to include sample code that reproduces the problem.**
143
143
 
@@ -145,7 +145,7 @@ For more info about Stylus syntax and its features, you can check the [project r
145
145
 
146
146
  ## Changelog
147
147
 
148
- [Available here.](https://github.com/forgecrafted/ruby-stylus/blob/master/CHANGELOG.md)
148
+ [Available here.](https://github.com/epuber-io/ruby-stylus/blob/master/CHANGELOG.md)
149
149
 
150
150
  ## License
151
151
 
@@ -17,11 +17,15 @@ function compile(str, options, plugins, imports, definitions) {
17
17
  obj = definitions[definition];
18
18
  value = obj.value
19
19
 
20
- if(obj.literal) {
21
- value = new stylus.nodes.Literal(value);
20
+ if (typeof value === 'object') {
21
+ style.define(definition, value, true);
22
+ } else {
23
+ if (obj.literal == true) {
24
+ value = new stylus.nodes.Literal(value);
25
+ }
26
+
27
+ style.define(definition, value);
22
28
  }
23
-
24
- style.define(definition, value);
25
29
  }
26
30
 
27
31
  style.render(function(error, css) {
@@ -37,4 +41,4 @@ function convert(str) {
37
41
 
38
42
  function version() {
39
43
  return stylus.version;
40
- }
44
+ }
@@ -1,3 +1,3 @@
1
1
  module Stylus
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -41,6 +41,6 @@ describe 'Rails integration' do
41
41
  end
42
42
 
43
43
  it 'loads the app normally even when the asset pipeline is disabled' do
44
- pending "TODO: supress the sprockets-rails railtie to test this."
44
+ # pending "TODO: supress the sprockets-rails railtie to test this."
45
45
  end
46
46
  end
@@ -30,7 +30,7 @@ describe 'Sprockets setup' do
30
30
 
31
31
  it 'configure the debug and compress flags' do
32
32
  Stylus.setup(env, debug: true, compress: true)
33
- expect(Stylus.debug).to be_true
34
- expect(Stylus.compress).to be_true
33
+ expect(Stylus.debug).to eq true
34
+ expect(Stylus.compress).to eq true
35
35
  end
36
36
  end
@@ -53,7 +53,7 @@ describe Stylus do
53
53
 
54
54
  it 'stores the given plugins' do
55
55
  Stylus.use :one, :two, argument: true
56
- expect(Stylus).to have(2).plugins
56
+ expect(Stylus.plugins.count).to eq 2
57
57
  end
58
58
 
59
59
  it 'includes the given plugins' do
@@ -64,7 +64,7 @@ describe Stylus do
64
64
 
65
65
  it 'stores the define calls' do
66
66
  Stylus.define "mystring", "test"
67
- expect(Stylus).to have(1).definitions
67
+ expect(Stylus.definitions.count).to eq 1
68
68
  end
69
69
 
70
70
  it 'defines a global variable string' do
@@ -79,6 +79,26 @@ describe Stylus do
79
79
  expect(Stylus.compile(input)).to match(/content: red/)
80
80
  end
81
81
 
82
+ it 'defines a global object/hash variable' do
83
+ Stylus.define "myobject", {value: 'mystring'}
84
+ input, output = fixture(:definition_object)
85
+ compiled = Stylus.compile(input)
86
+ expect(compiled).to match(/content: 'mystring'/)
87
+ expect(compiled).to match(/content2: 'mystring'/)
88
+ end
89
+
90
+ it 'defines a global object/hash variable with conditions support' do
91
+ Stylus.define "myobject", {value: 'mystring'}
92
+ input, output = fixture(:definition_object)
93
+ expect(Stylus.compile(input)).to match(/content3: 'if_true'/)
94
+ end
95
+
96
+ it 'defines a global object/hash variable with conditions support (negative case)' do
97
+ Stylus.define "myobject", {value2: 'mystring'}
98
+ input, output = fixture(:definition_object)
99
+ expect(Stylus.compile(input)).to match(/content3: 'if_false'/)
100
+ end
101
+
82
102
  it 'includes and imports "nib" automatically' do
83
103
  Stylus.nib = true
84
104
  input, output = fixture(:nib)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epuber-stylus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Lucas Mazza
7
+ - Roman Kříž
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-08 00:00:00.000000000 Z
11
+ date: 2016-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.8.0
55
55
  description: Bridge library to compile .styl stylesheets from ruby code.
56
56
  email:
57
- - luc4smazza@gmail.com
57
+ - roman@kriz.io
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
@@ -93,7 +93,7 @@ files:
93
93
  - spec/support/matchers.rb
94
94
  - spec/tilt/rails_spec.rb
95
95
  - spec/tilt/stylus_spec.rb
96
- homepage: https://github.com/lucasmazza/ruby-stylus
96
+ homepage: https://github.com/epuber-io/ruby-stylus
97
97
  licenses:
98
98
  - MIT
99
99
  metadata: {}