less-rails 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +2 -1
- data/.travis.yml +6 -14
- data/Appraisals +1 -1
- data/CHANGELOG.md +33 -57
- data/gemfiles/.keep +0 -0
- data/lib/less/rails/import_processor.rb +13 -10
- data/lib/less/rails/railtie.rb +30 -17
- data/lib/less/rails/template_handlers.rb +2 -0
- data/lib/less/rails/version.rb +1 -1
- data/test/cases/basics_spec.rb +15 -2
- data/test/dummy_app/app/assets/stylesheets/basics.css.less +1 -0
- data/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less +5 -0
- data/test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables_via_relative_path.less +2 -0
- data/test/spec_helper.rb +1 -0
- metadata +5 -5
- data/gemfiles/rails31.gemfile +0 -9
- data/gemfiles/rails32.gemfile +0 -9
- data/gemfiles/rails40.gemfile +0 -9
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTBiNWI5NzczYTlhNzc2MTMxZDcxYjQ3N2RhMmQ2OTgwNjM5MjVmNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzYxZWIzZDBkZmIxZTNlMWUwY2E4MGMzZGY3OTk1ZDdjMzYzZTAzYQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzIyZTMyYmY3NjMyYmRmN2RhY2YwZTk5ODZiZjgwMGJlMTIxY2NkOTk4ZjE2
|
10
|
+
ZmExOTc1NWY5MWQxZDJmNzUyZTU2MmE5MzU0OWM2MGMzODE5ZDMxZTg1YzQ5
|
11
|
+
NTlkNGQ2OWY2ZWQ5Y2I3NzExZjM3ODRkMjUxZmZiMzU1Mzc3MmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTc3NzA2MTg1MjNiOTZkMTBhYzNmNDI0MDZlNzEyOTA1MzZhMzcxMzliMjgy
|
14
|
+
MDUxMzk5ZWRhYTVkNjRlMTljNDBjOGU3MDA2NzI1ZWQ4ZThlOTIxMjljNzk0
|
15
|
+
OGFiNzY0MDJhOGE4ZTM1NTAwN2RjYjA1ZjliOTlkODM1NjY2NDQ=
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,21 +1,13 @@
|
|
1
1
|
rvm:
|
2
|
-
- 1.8.7
|
3
2
|
- 1.9.3
|
4
3
|
- 2.0.0
|
5
|
-
- jruby-18mode
|
6
4
|
- jruby-19mode
|
7
|
-
gemfile:
|
8
|
-
- gemfiles/rails31.gemfile
|
9
|
-
- gemfiles/rails32.gemfile
|
10
|
-
- gemfiles/rails40.gemfile
|
11
5
|
before_install:
|
12
6
|
- gem install bundler
|
13
7
|
- bundle --version
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- rvm: jruby-19mode
|
21
|
-
gemfile: gemfiles/rails40.gemfile
|
8
|
+
install:
|
9
|
+
- bundle install
|
10
|
+
before_script:
|
11
|
+
- bundle exec rake appraisal:setup
|
12
|
+
script:
|
13
|
+
- bundle exec rake appraisal test
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,138 +1,114 @@
|
|
1
|
-
CHANGELOG
|
2
|
-
=========
|
1
|
+
# CHANGELOG
|
3
2
|
|
4
|
-
2.4.
|
3
|
+
### 2.4.1 - 2013-09-07
|
5
4
|
|
6
|
-
*
|
5
|
+
* Fix import hooks to allow relative paths to files. Fixes #72 and #64.
|
6
|
+
* Use config.(before|after)_initialize for better railtie pattern. Fixed #68.
|
7
7
|
|
8
|
+
### 2.4.0 - 2013-09-04
|
8
9
|
|
9
|
-
2.
|
10
|
+
* Moving to less.rb 2.4.x which is current v### 1.4.2 of less.
|
10
11
|
|
11
|
-
|
12
|
+
### 2.3.3 - 2013-04-16
|
12
13
|
|
14
|
+
* Implement dumpLineNumbers functionality. Thanks @matthew342.
|
13
15
|
|
14
|
-
2.3.2 - 03
|
16
|
+
### 2.3.2 - 2013-03-06
|
15
17
|
|
16
18
|
* Rails 4 compatability. Thanks @zhengjia.
|
17
19
|
|
20
|
+
### 2.3.1 - 2013-03-06
|
18
21
|
|
19
|
-
2.3.1
|
20
|
-
|
21
|
-
* Update to less gem 2.3.1 which really uses less v1.3.3
|
22
|
+
* Update to less gem ### 2.3.1 which really uses less v### 1.3.3
|
22
23
|
|
24
|
+
### 2.3.0 - 2013-03-06
|
23
25
|
|
24
|
-
2.3.0
|
26
|
+
* Update to less gem ### 2.3.0 thanks @leifcr
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
2.2.6 - 10/31/2012
|
28
|
+
### 2.2.6 - 2012-10-31
|
30
29
|
|
31
30
|
* Accidental release. Nothing new.
|
32
31
|
|
33
|
-
|
34
|
-
2.2.5 - 10/28/2012
|
32
|
+
### 2.2.5 - 2012-10-28
|
35
33
|
|
36
34
|
* Real Rails 4 compatability thanks to @yalab
|
37
35
|
|
38
|
-
|
39
|
-
2.2.4 - 10/20/2012
|
36
|
+
### 2.2.4 - 2012-10-20
|
40
37
|
|
41
38
|
* Rails 4 compatability with Sprockets vs app.assets.
|
42
39
|
|
43
|
-
|
44
|
-
2.2.3 - 05/27/2012
|
40
|
+
### 2.2.3 - 2012-05-27
|
45
41
|
|
46
42
|
* Add default_mime_type to template class since it does not inherit from Tilt's.
|
47
43
|
Should fix https://github.com/metaskills/less-rails/issues/35
|
48
44
|
|
49
|
-
|
50
|
-
2.2.2 - 04/25/2012
|
45
|
+
### 2.2.2 - 2012-04-25
|
51
46
|
|
52
47
|
* Remove explicit dependency on therubyracer
|
53
48
|
* Add jruby and jruby --1.9 to travis configuration
|
54
49
|
* Officially support JRuby
|
55
50
|
|
56
|
-
|
57
|
-
2.2.1 - 04/15/2012
|
51
|
+
### 2.2.1 - 2012-04-15
|
58
52
|
|
59
53
|
* Make it usable with therubyrhino (and older versions of therubyracer as well). Fixes #36.
|
60
54
|
|
61
|
-
|
62
|
-
2.2.0 - 03/29/2012
|
55
|
+
### 2.2.0 - 2012-03-29
|
63
56
|
|
64
57
|
* Upgrade to therubyracer 0.10.x call semantics. Fixes #34.
|
65
58
|
|
66
|
-
|
67
|
-
2.1.8 - 03/15/2012
|
59
|
+
### 2.1.8 - 2012-03-15
|
68
60
|
|
69
61
|
* Work with edge rails/sprockets. Fixes #31.
|
70
62
|
|
71
|
-
|
72
|
-
2.1.7 - 03/07/2012
|
63
|
+
### 2.1.7 - 2012-03-07
|
73
64
|
|
74
65
|
* More defensive railtie when examing asset paths. Fixes #30.
|
75
66
|
|
76
|
-
|
77
|
-
2.1.6 - 02/16/2012
|
67
|
+
### 2.1.6 - 2012-02-16
|
78
68
|
|
79
69
|
* Nested imports recursively declare sprockets dependencies. Fixes #26.
|
80
70
|
|
81
|
-
|
82
|
-
2.1.4, 2.1.5 - 01/31/2012
|
71
|
+
### 2.1.4, ### 2.1.5 - 2012-01-31
|
83
72
|
|
84
73
|
* More friendly import processor with missing files. Fixes #13.
|
85
74
|
|
86
|
-
|
87
|
-
2.1.3 - 01/23/2012
|
75
|
+
### 2.1.3 - 2012-01-23
|
88
76
|
|
89
77
|
* Make sure vendor/assets/stylesheets .less files work.
|
90
78
|
|
91
|
-
|
92
|
-
2.1.2 - 12/20/2011
|
79
|
+
### 2.1.2 - 2011-12-20
|
93
80
|
|
94
81
|
* No notes.
|
95
82
|
|
96
|
-
|
97
|
-
2.1.1 - 11/24/2011
|
98
|
-
------------------
|
83
|
+
### 2.1.1 - 2011-11-24
|
99
84
|
|
100
85
|
* All app asset stylesheet paths are added to less paths.
|
101
86
|
|
87
|
+
### 2.1.0 - 2011-11-18
|
102
88
|
|
103
|
-
2.1.0 - 11/18/2011
|
104
|
-
------------------
|
105
89
|
* Remove our basic CssCompressor since it can not handle real world general purpose JS
|
106
90
|
compression. Instead set parse compression and recommend final YUI Compressor. Fixes #7.
|
107
91
|
* Import preprocessor so @import'ed less files are automatic asset dependencies. Fixes #3.
|
108
92
|
|
93
|
+
### 2.0.3 - 2011-11-13
|
109
94
|
|
110
|
-
2.0.3 - 11/13/2011
|
111
|
-
------------------
|
112
95
|
* Add generator support. Fixes #8.
|
113
96
|
* Add a Less::Rails::CssCompressor if config.assets.compress is true. Fixes #7.
|
114
97
|
|
98
|
+
### 2.0.2 - 2011-10-09
|
115
99
|
|
116
|
-
2.0.2 - 10/09/2011
|
117
|
-
------------------
|
118
100
|
* Extend LESS with Rails asset pipeline helpers.
|
119
101
|
* New testing support with MiniTest::Spec and dummy Rails::Application.
|
120
102
|
* New config.options hash passed down to the #to_css method.
|
121
103
|
|
122
|
-
|
123
|
-
2.0.1 - 09/28/2011
|
124
|
-
------------------
|
104
|
+
### 2.0.1 - 2011-09-28
|
125
105
|
|
126
106
|
* Fix require of less/rails/railtie.rb. Thanks Benoit Bénézech (bbenezech).
|
127
107
|
|
128
|
-
|
129
|
-
2.0.0 - 09/25/2011
|
130
|
-
------------------
|
108
|
+
### 2.0.0 - 2011-09-25
|
131
109
|
|
132
110
|
* Initial 2.0 release. Heavily inspired/copied code from sass-rails.
|
133
111
|
|
134
|
-
|
135
|
-
1.0.0 - 02/02/2010
|
136
|
-
------------------
|
112
|
+
### 1.0.0 - 2010-02-02
|
137
113
|
|
138
114
|
* Original project at http://github.com/yeastymobs/less-rails
|
data/gemfiles/.keep
ADDED
File without changes
|
@@ -3,6 +3,13 @@ module Less
|
|
3
3
|
class ImportProcessor < Tilt::Template
|
4
4
|
|
5
5
|
IMPORT_SCANNER = /@import\s*['"]([^'"]+)['"]\s*;/.freeze
|
6
|
+
PATHNAME_FINDER = Proc.new { |scope, path|
|
7
|
+
begin
|
8
|
+
scope.resolve(path)
|
9
|
+
rescue Sprockets::FileNotFound
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
}
|
6
13
|
|
7
14
|
def prepare
|
8
15
|
end
|
@@ -11,21 +18,17 @@ module Less
|
|
11
18
|
depend_on scope, data
|
12
19
|
data
|
13
20
|
end
|
14
|
-
|
15
|
-
def depend_on(scope, data)
|
21
|
+
|
22
|
+
def depend_on(scope, data, base=File.dirname(scope.logical_path))
|
16
23
|
import_paths = data.scan(IMPORT_SCANNER).flatten.compact.uniq
|
17
24
|
import_paths.each do |path|
|
18
|
-
pathname =
|
19
|
-
|
20
|
-
|
21
|
-
nil
|
22
|
-
end
|
23
|
-
scope.depend_on(path) if pathname && pathname.to_s.ends_with?('.less')
|
24
|
-
depend_on scope, File.read(pathname) if pathname
|
25
|
+
pathname = PATHNAME_FINDER.call(scope,path) || PATHNAME_FINDER.call(scope, File.join(base, path))
|
26
|
+
scope.depend_on(pathname) if pathname && pathname.to_s.ends_with?('.less')
|
27
|
+
depend_on scope, File.read(pathname), File.dirname(path) if pathname
|
25
28
|
end
|
26
29
|
data
|
27
30
|
end
|
28
|
-
|
31
|
+
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
data/lib/less/rails/railtie.rb
CHANGED
@@ -10,24 +10,37 @@ module Less
|
|
10
10
|
config.less.paths = []
|
11
11
|
config.less.compress = false
|
12
12
|
config.app_generators.stylesheet_engine :less
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
initializer 'less-rails.before.load_config_initializers', :before => :load_config_initializers, :group => :all do |app|
|
22
|
-
if ::Rails::VERSION::MAJOR < 4
|
23
|
-
raise 'The less-rails plugin requires the asset pipeline to be enabled.' unless app.config.assets.enabled
|
13
|
+
|
14
|
+
if ::Rails::VERSION::STRING =~ /\A3.[12]/
|
15
|
+
|
16
|
+
config.before_initialize do |app|
|
17
|
+
require 'less'
|
18
|
+
require 'less-rails'
|
19
|
+
Sprockets::Engines #force autoloading
|
20
|
+
Sprockets.register_engine '.less', LessTemplate
|
24
21
|
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
|
23
|
+
initializer 'less-rails.after.load_config_initializers', :after => :load_config_initializers, :group => :all do |app|
|
24
|
+
(Sprockets.respond_to?('register_preprocessor') ? Sprockets : app.assets).register_preprocessor 'text/css', ImportProcessor
|
25
|
+
app.assets.context_class.extend(LessContext)
|
26
|
+
app.assets.context_class.less_config = app.config.less
|
27
|
+
end
|
28
|
+
|
29
|
+
else
|
30
|
+
|
31
|
+
config.before_initialize do |app|
|
32
|
+
require 'less'
|
33
|
+
require 'less-rails'
|
34
|
+
Sprockets::Engines #force autoloading
|
35
|
+
Sprockets.register_engine '.less', LessTemplate
|
36
|
+
(Sprockets.respond_to?('register_preprocessor') ? Sprockets : app.assets).register_preprocessor 'text/css', ImportProcessor
|
37
|
+
end
|
38
|
+
|
39
|
+
config.after_initialize do |app|
|
40
|
+
app.assets.context_class.extend(LessContext)
|
41
|
+
app.assets.context_class.less_config = app.config.less
|
42
|
+
end
|
43
|
+
|
31
44
|
end
|
32
45
|
|
33
46
|
initializer 'less-rails.after.append_assets_path', :after => :append_assets_path, :group => :all do |app|
|
@@ -24,6 +24,8 @@ module Less
|
|
24
24
|
|
25
25
|
def config_to_less_parser_options(scope)
|
26
26
|
paths = config_paths(scope) + scope.environment.paths
|
27
|
+
local_path = scope.pathname.dirname
|
28
|
+
paths += [local_path] unless paths.include? local_path
|
27
29
|
{:filename => eval_file, :line => line, :paths => paths, :dumpLineNumbers => config_from_rails(scope).line_numbers}
|
28
30
|
end
|
29
31
|
|
data/lib/less/rails/version.rb
CHANGED
data/test/cases/basics_spec.rb
CHANGED
@@ -33,7 +33,16 @@ class BasicsSpec < Less::Rails::Spec
|
|
33
33
|
basics.must_match %r{#test-variable-colored\{color:#666\}}, 'variables.less should be a sprockets context dependency'
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
|
+
it 'must update when an imported file of another imported file changes, and that file is imported via a relative path' do
|
38
|
+
basics.must_match %r{#test-variable-relative-path-colored}i, 'default is #BADA55'
|
39
|
+
safely_edit(:variables_via_relative_path) do |data, asset|
|
40
|
+
data.gsub! 'BADA55', 'BA73A2'
|
41
|
+
File.open(asset.pathname,'w') { |f| f.write(data) }
|
42
|
+
basics.must_match %r{#test-variable-relative-path-colored}i, 'variables_via_relative_path.less should be a sprockets context dependency'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
37
46
|
end
|
38
47
|
|
39
48
|
protected
|
@@ -49,7 +58,11 @@ class BasicsSpec < Less::Rails::Spec
|
|
49
58
|
def variables_asset
|
50
59
|
dummy_assets['frameworks/bootstrap/variables.less']
|
51
60
|
end
|
52
|
-
|
61
|
+
|
62
|
+
def variables_via_relative_path_asset
|
63
|
+
dummy_assets['frameworks/bootstrap/variables_via_relative_path.less']
|
64
|
+
end
|
65
|
+
|
53
66
|
def safely_edit(name)
|
54
67
|
asset = send :"#{name}_asset"
|
55
68
|
data = File.read(asset.pathname)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
2
|
@import "frameworks/bootstrap/variables";
|
3
|
+
@import "variables_via_relative_path";
|
3
4
|
|
4
5
|
.radiused(@radius: 5px) {
|
5
6
|
border-radius: @radius;
|
@@ -8,3 +9,7 @@
|
|
8
9
|
.variableColored() {
|
9
10
|
color: @variableColor;
|
10
11
|
}
|
12
|
+
|
13
|
+
.variableRelativePathColored() {
|
14
|
+
color: @variableRelativePathColor;
|
15
|
+
}
|
data/test/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,9 +111,7 @@ files:
|
|
111
111
|
- MIT-LICENSE
|
112
112
|
- README.md
|
113
113
|
- Rakefile
|
114
|
-
- gemfiles
|
115
|
-
- gemfiles/rails32.gemfile
|
116
|
-
- gemfiles/rails40.gemfile
|
114
|
+
- gemfiles/.keep
|
117
115
|
- less-rails.gemspec
|
118
116
|
- lib/less-rails.rb
|
119
117
|
- lib/less/rails.rb
|
@@ -134,6 +132,7 @@ files:
|
|
134
132
|
- test/dummy_app/app/assets/stylesheets/basics.css.less
|
135
133
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less
|
136
134
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables.less
|
135
|
+
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables_via_relative_path.less
|
137
136
|
- test/dummy_app/app/assets/stylesheets/helpers.css.less
|
138
137
|
- test/dummy_app/init.rb
|
139
138
|
- test/dummy_app/tmp/.gitkeep
|
@@ -173,6 +172,7 @@ test_files:
|
|
173
172
|
- test/dummy_app/app/assets/stylesheets/basics.css.less
|
174
173
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/mixins.less
|
175
174
|
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables.less
|
175
|
+
- test/dummy_app/app/assets/stylesheets/frameworks/bootstrap/variables_via_relative_path.less
|
176
176
|
- test/dummy_app/app/assets/stylesheets/helpers.css.less
|
177
177
|
- test/dummy_app/init.rb
|
178
178
|
- test/dummy_app/tmp/.gitkeep
|
data/gemfiles/rails31.gemfile
DELETED
data/gemfiles/rails32.gemfile
DELETED
data/gemfiles/rails40.gemfile
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "therubyracer", "~> 0.10.0", :require=>nil, :platforms=>:ruby
|
6
|
-
gem "therubyrhino", "~> 2.0.2", :require=>nil, :platforms=>:jruby
|
7
|
-
gem "rails", "~> 4.0.0.beta"
|
8
|
-
|
9
|
-
gemspec :path=>"../"
|