dassets-lessv1 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/dassets-lessv1.gemspec +1 -1
- data/lib/dassets-lessv1.rb +10 -5
- data/lib/dassets-lessv1/version.rb +1 -1
- data/test/unit/engine_tests.rb +9 -0
- metadata +8 -7
data/dassets-lessv1.gemspec
CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |gem|
|
|
22
22
|
# lock in to the 1.x.x LESS ruby compiler b/c this is Lessv1
|
23
23
|
# ie https://github.com/cloudhead/less/tree/v1.2.21
|
24
24
|
gem.add_dependency("less", ["~> 1.1"])
|
25
|
-
gem.add_dependency("dassets")
|
25
|
+
gem.add_dependency("dassets", ["~> 0.6"])
|
26
26
|
|
27
27
|
end
|
data/lib/dassets-lessv1.rb
CHANGED
@@ -11,19 +11,24 @@ module Dassets::Lessv1
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def compile(input_content)
|
14
|
-
|
14
|
+
compiler(input_content).to_css
|
15
|
+
end
|
16
|
+
|
17
|
+
def compiler(content)
|
18
|
+
Compiler.new(content, self.opts)
|
15
19
|
end
|
16
20
|
|
17
21
|
end
|
18
22
|
|
19
23
|
# This is a little wrapper class to the less engine. I use this to access
|
20
24
|
# and set the `@path` instance variable on the engine. This sets the root
|
21
|
-
# path all imports are done from
|
25
|
+
# path all imports are done from to the path of the source the engine was
|
26
|
+
# registered on. This allows you to import partials relative to the source.
|
22
27
|
|
23
|
-
class
|
28
|
+
class Compiler < ::Less::Engine
|
24
29
|
attr_reader :path
|
25
|
-
def initialize(content, opts
|
26
|
-
@path =
|
30
|
+
def initialize(content, opts)
|
31
|
+
@path = opts['source_path']
|
27
32
|
super
|
28
33
|
end
|
29
34
|
end
|
data/test/unit/engine_tests.rb
CHANGED
@@ -11,12 +11,21 @@ class Dassets::Lessv1::Engine
|
|
11
11
|
end
|
12
12
|
subject{ @engine }
|
13
13
|
|
14
|
+
should have_instance_method :compiler
|
15
|
+
|
14
16
|
should "be a Dassets engine" do
|
15
17
|
assert_kind_of Dassets::Engine, subject
|
16
18
|
assert_respond_to 'ext', subject
|
17
19
|
assert_respond_to 'compile', subject
|
18
20
|
end
|
19
21
|
|
22
|
+
should "use a Less compiler with the path set to the source path" do
|
23
|
+
c = subject.compiler('')
|
24
|
+
assert_kind_of ::Less::Engine, c
|
25
|
+
assert_respond_to :to_css, c
|
26
|
+
assert_equal subject.opts['source_path'], c.path
|
27
|
+
end
|
28
|
+
|
20
29
|
should "transform any input extension to `css`" do
|
21
30
|
assert_equal 'css', subject.ext('less')
|
22
31
|
assert_equal 'css', subject.ext('lss')
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dassets-lessv1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kelly Redding
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-05-
|
19
|
+
date: 2013-05-09 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: assert
|
@@ -53,12 +53,13 @@ dependencies:
|
|
53
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ~>
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
hash:
|
58
|
+
hash: 7
|
59
59
|
segments:
|
60
60
|
- 0
|
61
|
-
|
61
|
+
- 6
|
62
|
+
version: "0.6"
|
62
63
|
type: :runtime
|
63
64
|
version_requirements: *id003
|
64
65
|
description: Dassets engine for compiling LESS CSS using the 1.x.x Ruby compiler
|