guard-lessc 0.0.1
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.
- data/.gitignore +17 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +60 -0
- data/Rakefile +1 -0
- data/guard-lessc.gemspec +26 -0
- data/lib/guard/lessc/templates/Guardfile +3 -0
- data/lib/guard/lessc/version.rb +5 -0
- data/lib/guard/lessc.rb +46 -0
- metadata +122 -0
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Eric Berry
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Guard::Lessc
|
2
|
+
|
3
|
+
Automatically compiles a less file to a target output file using the lessc command.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
This guard is dependant on lessc so install that first:
|
8
|
+
|
9
|
+
```
|
10
|
+
$ npm install -g less
|
11
|
+
```
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
``` ruby
|
16
|
+
group :development do
|
17
|
+
gem 'guard-lessc'
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
```
|
24
|
+
$ bundle
|
25
|
+
```
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
```
|
30
|
+
$ gem install guard-lessc
|
31
|
+
```
|
32
|
+
|
33
|
+
Add a default configuration to your guardfile:
|
34
|
+
|
35
|
+
```
|
36
|
+
$ guard init lessc
|
37
|
+
```
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
See the [guard usage documentation](https://github.com/guard/guard#readme) for
|
42
|
+
more guard usage information.
|
43
|
+
|
44
|
+
## Guardfile
|
45
|
+
|
46
|
+
This sample guard will run ember build for any change in the javascripts directory,
|
47
|
+
excluding the three files that `ember build` uses to compile the application.
|
48
|
+
``` ruby
|
49
|
+
guard :lessc, :in_file => 'less/main.less', :out_file => 'public/stylesheets/application.css', :compress => true do
|
50
|
+
watch(%r{^.*\.less$})
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
1. Fork it
|
57
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
58
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
59
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
60
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/guard-lessc.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'guard/lessc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "guard-lessc"
|
8
|
+
spec.version = Guard::Lessc::VERSION
|
9
|
+
spec.authors = ["Eric Berry"]
|
10
|
+
spec.email = ["cavneb@gmail.com"]
|
11
|
+
spec.description = "Guard::Lessc automatically compiles less files to a target file when changes are made"
|
12
|
+
spec.summary = "Guard gem for the lessc command"
|
13
|
+
spec.homepage = "https://github.com/cavneb/guard-lessc"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "guard"
|
22
|
+
spec.add_dependency "colorize"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
26
|
+
end
|
data/lib/guard/lessc.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require "guard"
|
2
|
+
require "guard/guard"
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
module Lessc < Guard
|
6
|
+
require 'colorize'
|
7
|
+
|
8
|
+
def initialize(watchers = [], options = {})
|
9
|
+
super
|
10
|
+
@options = {
|
11
|
+
:yui_compress => false,
|
12
|
+
:compress => false,
|
13
|
+
:paths => [],
|
14
|
+
:optimization => 1,
|
15
|
+
:in_file => '',
|
16
|
+
:out_file => ''
|
17
|
+
}.merge(options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_all
|
21
|
+
lessc
|
22
|
+
end
|
23
|
+
|
24
|
+
def run_on_changes(path)
|
25
|
+
puts "detected changes in #{path.join(', ')}".yellow
|
26
|
+
lessc
|
27
|
+
end
|
28
|
+
|
29
|
+
def lessc
|
30
|
+
command = "lessc #{generate_cl_arguments}"
|
31
|
+
puts command
|
32
|
+
puts `#{command}`
|
33
|
+
end
|
34
|
+
|
35
|
+
def generate_cl_arguments
|
36
|
+
args = []
|
37
|
+
args << "-x" if @options[:compress]
|
38
|
+
args << "--yui-compress" if @options[:yui_compress]
|
39
|
+
args << "--paths #{@options[:paths].join(':')}" if @options[:paths].size > 0
|
40
|
+
args << "--optimization #{@options[:optimization]}" if @options[:optimization]
|
41
|
+
args << "> #{@options[:out_file]}" if @options[:out_file]
|
42
|
+
args.join(' ')
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-lessc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Eric Berry
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: guard
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
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: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: colorize
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.3'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: Guard::Lessc automatically compiles less files to a target file when
|
79
|
+
changes are made
|
80
|
+
email:
|
81
|
+
- cavneb@gmail.com
|
82
|
+
executables: []
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- .gitignore
|
87
|
+
- CHANGELOG.md
|
88
|
+
- Gemfile
|
89
|
+
- LICENSE.txt
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- guard-lessc.gemspec
|
93
|
+
- lib/guard/lessc.rb
|
94
|
+
- lib/guard/lessc/templates/Guardfile
|
95
|
+
- lib/guard/lessc/version.rb
|
96
|
+
homepage: https://github.com/cavneb/guard-lessc
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.8.25
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Guard gem for the lessc command
|
121
|
+
test_files: []
|
122
|
+
has_rdoc:
|