less-rails 2.7.1 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e54779fecc277d32f1b4f70d5e10da49fe0a59ca
4
- data.tar.gz: 3d4cd5d479f4e8a9c37979da4d18e666dd7f42cc
3
+ metadata.gz: 0fe9397581bb0fdd5aaeb11cd2c0d1b2517678e3
4
+ data.tar.gz: ccbc64b1095619266a377808b8800cb9a0e53189
5
5
  SHA512:
6
- metadata.gz: 7330b4e045a050f50d2377b36b37f856c96e9a312737ec0a1343e4efce30faa33a2cb6a44e22409785f35e63a25cdbe5dc8717c5bde82e4f7e75c819fa247087
7
- data.tar.gz: 82ebd9522014b036bbb32c1f1261bc8d3b1439831bfbeeafda8115d4a813781473cb628661c62a4fd189e7e07b0afc4183671a544a0b33d3af239321da02440b
6
+ metadata.gz: 9309e8ddb0b87e1d44cd60395c85e03e58c9eb0dd0398cc6c5507d4a1b0e5bcd656ab1ac193314cae2355fbd2523a56cdd136b8bf67d45ba3cae2cd734e47f04
7
+ data.tar.gz: 6f9a8baca9fe6539bfc7dcf8c00b39f2c9d4ed08c5c7aa4d577b58df016ca679dc573474a830fff55b6c051d170470ad90a5719090c0d149312f634e746a8d4a
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### 2.8.0 - ?
4
+
5
+ * Make it possible to pass parameters to less.rb
6
+ Fixes https://github.com/metaskills/less-rails/issues/94
7
+
3
8
  ### 2.7.1 - 2016-09-01
4
9
 
5
10
  * Fix Sprockets 3 integration. Thanks @suzan2go and @ccallebs!
data/Gemfile CHANGED
@@ -3,3 +3,5 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
  gem "therubyracer", "~> 0.12.0", :require => nil, :platforms => :ruby
5
5
  gem "therubyrhino", "~> 2.0.2", :require => nil, :platforms => :jruby
6
+
7
+ gem "mime-types", "~> 2.6.2", :platforms => [:ruby_19, :jruby]
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.png)](http://travis-ci.org/metaskills/less-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
@@ -6,6 +6,7 @@ module Less
6
6
  config.less = ActiveSupport::OrderedOptions.new
7
7
  config.less.paths = []
8
8
  config.less.compress = false
9
+ config.less.raw = ActiveSupport::OrderedOptions.new
9
10
  config.app_generators.stylesheet_engine :less
10
11
 
11
12
  config.before_initialize do |app|
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Less
2
2
  module Rails
3
- VERSION = "2.7.1"
3
+ VERSION = "2.8.0"
4
4
  end
5
5
  end
@@ -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
@@ -16,3 +16,5 @@
16
16
  // Vendored
17
17
  @import "vendored";
18
18
  #test-vendored { .vendored; }
19
+
20
+ @import "frameworks/bootstrap/relative_path_url";
@@ -0,0 +1,3 @@
1
+ body {
2
+ background-image: url('../../i-have-no-imagination.png');
3
+ }
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.7.1
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-01-09 00:00:00.000000000 Z
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: