zassets-plugins-less 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/lib/zassets-plugins-less.rb +8 -0
- data/lib/zassets/plugins/less/registrant.rb +15 -0
- data/lib/zassets/plugins/less/template.rb +50 -0
- data/lib/zassets/plugins/less/version.rb +7 -0
- data/zassets-plugins-less.gemspec +19 -0
- metadata +70 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/Gemfile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
require 'less'
|
3
|
+
|
4
|
+
module ZAssets
|
5
|
+
module Plugins
|
6
|
+
module LESS
|
7
|
+
class Template < Tilt::Template
|
8
|
+
self.default_mime_type = 'text/css'
|
9
|
+
|
10
|
+
def self.engine_initialized?
|
11
|
+
defined? ::Less
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize_engine
|
15
|
+
require_template_library 'less'
|
16
|
+
end
|
17
|
+
|
18
|
+
def prepare
|
19
|
+
end
|
20
|
+
|
21
|
+
def evaluate(context, locals, &block)
|
22
|
+
options = {
|
23
|
+
:filename => eval_file,
|
24
|
+
:paths => [File.dirname(eval_file)]
|
25
|
+
}
|
26
|
+
parser = ::Less::Parser.new(options)
|
27
|
+
tree = parser.parse(data)
|
28
|
+
depend_on(context, eval_file)
|
29
|
+
tree.to_css
|
30
|
+
rescue ::Less::ParseError => e
|
31
|
+
context.__LINE__ = e.line
|
32
|
+
raise e
|
33
|
+
end
|
34
|
+
|
35
|
+
def depend_on(context, path)
|
36
|
+
parser = ::Less::Parser.new({
|
37
|
+
:filename => path,
|
38
|
+
:paths => [File.dirname(path)]
|
39
|
+
})
|
40
|
+
parser.parse(File.read(path))
|
41
|
+
parser.imports.each do |i|
|
42
|
+
dependency_path = File.join(File.dirname(path), i)
|
43
|
+
context.depend_on(dependency_path)
|
44
|
+
depend_on(context, dependency_path)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
require 'zassets/plugins/less/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'zassets-plugins-less'
|
6
|
+
s.version = ZAssets::Plugins::LESS::VERSION
|
7
|
+
s.summary = "zassets-plugins-less-#{ZAssets::Plugins::LESS::VERSION}"
|
8
|
+
s.description = <<-eoh.gsub(/^ +/, '')
|
9
|
+
LESS template engine for zassets.
|
10
|
+
eoh
|
11
|
+
s.homepage = 'https://rubygems.org/gems/zassets-plugins-less'
|
12
|
+
|
13
|
+
s.author = 'Thibault Jouan'
|
14
|
+
s.email = 'tj@a13.fr'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split "\n"
|
17
|
+
|
18
|
+
s.add_dependency 'less', '~> 2.2'
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zassets-plugins-less
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Thibault Jouan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: less
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.2'
|
30
|
+
description: ! 'LESS template engine for zassets.
|
31
|
+
|
32
|
+
'
|
33
|
+
email: tj@a13.fr
|
34
|
+
executables: []
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files: []
|
37
|
+
files:
|
38
|
+
- .gitignore
|
39
|
+
- Gemfile
|
40
|
+
- lib/zassets-plugins-less.rb
|
41
|
+
- lib/zassets/plugins/less/registrant.rb
|
42
|
+
- lib/zassets/plugins/less/template.rb
|
43
|
+
- lib/zassets/plugins/less/version.rb
|
44
|
+
- zassets-plugins-less.gemspec
|
45
|
+
homepage: https://rubygems.org/gems/zassets-plugins-less
|
46
|
+
licenses: []
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.8.23
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: zassets-plugins-less-0.0.1
|
69
|
+
test_files: []
|
70
|
+
has_rdoc:
|