less-rails 2.7.1 → 2.8.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 +5 -0
- data/Gemfile +2 -0
- data/README.md +11 -1
- data/lib/less/rails/railtie.rb +1 -0
- data/lib/less/rails/template_handlers.rb +5 -1
- data/lib/less/rails/version.rb +1 -1
- data/test/cases/basics_spec.rb +15 -0
- data/test/dummy_app/app/assets/stylesheets/basics.css.less +2 -0
- data/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/relative_path_url.less +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fe9397581bb0fdd5aaeb11cd2c0d1b2517678e3
|
4
|
+
data.tar.gz: ccbc64b1095619266a377808b8800cb9a0e53189
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9309e8ddb0b87e1d44cd60395c85e03e58c9eb0dd0398cc6c5507d4a1b0e5bcd656ab1ac193314cae2355fbd2523a56cdd136b8bf67d45ba3cae2cd734e47f04
|
7
|
+
data.tar.gz: 6f9a8baca9fe6539bfc7dcf8c00b39f2c9d4ed08c5c7aa4d577b58df016ca679dc573474a830fff55b6c051d170470ad90a5719090c0d149312f634e746a8d4a
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
This gem provides integration for Rails projects using the Less stylesheet language in the asset pipeline.
|
4
4
|
|
5
|
-
[![Build Status](https://secure.travis-ci.org/metaskills/minitest-spec-rails.
|
5
|
+
[![Build Status](https://secure.travis-ci.org/metaskills/minitest-spec-rails.svg)](http://travis-ci.org/metaskills/less-rails)
|
6
6
|
|
7
7
|
|
8
8
|
## Installing
|
@@ -60,6 +60,16 @@ Will end up acting as if you had done this below:
|
|
60
60
|
#leftnav { .border-radius(5px); }
|
61
61
|
```
|
62
62
|
|
63
|
+
## Passing parameters to less.rb
|
64
|
+
|
65
|
+
You can pass any parameters that the [`less.rb`](https://github.com/cowboyd/less.rb) gem (which `less-rails` is based upon) supports by modifying `Rails.application.config.less.raw`.
|
66
|
+
For example, `less.rb` uses [lessc --relative-urls](http://lesscss.org/usage/#command-line-usage-relative-urls) by default. This means that `url('../ralative/paths.png')` for `@import`ed files will be modified according to `.less` file location. To return back to default `lessc` behavior, add these lines to `config/initializers/assets.rb`:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
Rails.application.config.less.raw.relativeUrls = false
|
70
|
+
```
|
71
|
+
|
72
|
+
For more parameters supported by `less.rb`, please consult [less.rb gem](https://github.com/cowboyd/less.rb/blob/master/lib/less/defaults.rb).
|
63
73
|
|
64
74
|
|
65
75
|
## Helpers
|
data/lib/less/rails/railtie.rb
CHANGED
@@ -26,7 +26,7 @@ module Less
|
|
26
26
|
paths = config_paths(scope) + scope.environment.paths
|
27
27
|
local_path = scope.pathname.dirname
|
28
28
|
paths += [local_path] unless paths.include? local_path
|
29
|
-
{:filename => eval_file, :line => line, :paths => paths, :dumpLineNumbers => config_from_rails(scope).line_numbers}
|
29
|
+
{:filename => eval_file, :line => line, :paths => paths, :dumpLineNumbers => config_from_rails(scope).line_numbers}.merge(config_raw(scope))
|
30
30
|
end
|
31
31
|
|
32
32
|
def config_to_css_options(scope)
|
@@ -36,6 +36,10 @@ module Less
|
|
36
36
|
def config_paths(scope)
|
37
37
|
config_from_rails(scope)[:paths]
|
38
38
|
end
|
39
|
+
|
40
|
+
def config_raw(scope)
|
41
|
+
config_from_rails(scope)[:raw]
|
42
|
+
end
|
39
43
|
|
40
44
|
def config_from_rails(scope)
|
41
45
|
scope.environment.context_class.less_config
|
data/lib/less/rails/version.rb
CHANGED
data/test/cases/basics_spec.rb
CHANGED
@@ -45,6 +45,21 @@ class BasicsSpec < Less::Rails::Spec
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
+
describe 'relative path setting must be effective' do
|
49
|
+
after do
|
50
|
+
Rails.application.config.less.raw.clear
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'must use relavite paths by default' do
|
54
|
+
basics.must_match %r{body\{background-image:url\('i-have-no-imagination.png'\)\}}
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should respond to config modification' do
|
58
|
+
Rails.application.config.less.raw.relativeUrls = false
|
59
|
+
basics.must_match %r{body\{background-image:url\('../../i-have-no-imagination.png'\)\}}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
48
63
|
protected
|
49
64
|
|
50
65
|
def basics
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: less-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: less
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- test/dummy_app/app/assets/images/rails.png
|
180
180
|
- test/dummy_app/app/assets/stylesheets/basics.css.less
|
181
181
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less
|
182
|
+
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/relative_path_url.less
|
182
183
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables.less
|
183
184
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables_via_relative_path.less
|
184
185
|
- test/dummy_app/app/assets/stylesheets/helpers.css.less
|
@@ -220,6 +221,7 @@ test_files:
|
|
220
221
|
- test/dummy_app/app/assets/images/rails.png
|
221
222
|
- test/dummy_app/app/assets/stylesheets/basics.css.less
|
222
223
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less
|
224
|
+
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/relative_path_url.less
|
223
225
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables.less
|
224
226
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables_via_relative_path.less
|
225
227
|
- test/dummy_app/app/assets/stylesheets/helpers.css.less
|
@@ -228,3 +230,4 @@ test_files:
|
|
228
230
|
- test/dummy_app/tmp/cache/.gitkeep
|
229
231
|
- test/dummy_app/vendor/assets/stylesheets/vendored.less
|
230
232
|
- test/spec_helper.rb
|
233
|
+
has_rdoc:
|