less 2.0.4 → 2.1.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.
- data/.gitmodules +0 -3
- data/.travis.yml +10 -0
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/bin/lessc +21 -2
- data/less.gemspec +5 -3
- data/lib/less/defaults.rb +13 -0
- data/lib/less/js/CHANGELOG +41 -0
- data/lib/less/js/Makefile +21 -2
- data/lib/less/js/benchmark/benchmark.less +11 -11
- data/lib/less/js/benchmark/less-benchmark.js +3 -5
- data/lib/less/js/bin/lessc +52 -18
- data/lib/less/js/build/amd.js +6 -0
- data/lib/less/js/build/require-rhino.js +7 -0
- data/lib/less/js/dist/{less-1.0.44.js → less-1.1.4.js} +159 -45
- data/lib/less/js/dist/less-1.1.4.min.js +16 -0
- data/lib/less/js/dist/less-1.1.5.js +2805 -0
- data/lib/less/js/dist/less-1.1.5.min.js +9 -0
- data/lib/less/js/dist/less-1.1.6.js +3004 -0
- data/lib/less/js/dist/less-1.1.6.min.js +9 -0
- data/lib/less/js/dist/less-1.2.0.js +3293 -0
- data/lib/less/js/dist/less-1.2.0.min.js +9 -0
- data/lib/less/js/dist/less-1.2.1.js +3318 -0
- data/lib/less/js/dist/less-1.2.1.min.js +9 -0
- data/lib/less/js/dist/less-1.2.2.js +3337 -0
- data/lib/less/js/dist/less-1.2.2.min.js +9 -0
- data/lib/less/js/dist/less-1.3.0.js +3478 -0
- data/lib/less/js/dist/less-1.3.0.min.js +9 -0
- data/lib/less/js/dist/less-rhino-1.1.3.js +2460 -0
- data/lib/less/js/dist/less-rhino-1.1.5.js +2481 -0
- data/lib/less/js/lib/less/browser.js +38 -27
- data/lib/less/js/lib/less/colors.js +151 -0
- data/lib/less/js/lib/less/cssmin.js +355 -0
- data/lib/less/js/lib/less/functions.js +61 -7
- data/lib/less/js/lib/less/index.js +48 -37
- data/lib/less/js/lib/less/parser.js +327 -120
- data/lib/less/js/lib/less/rhino.js +62 -0
- data/lib/less/js/lib/less/tree/alpha.js +1 -1
- data/lib/less/js/lib/less/tree/anonymous.js +1 -1
- data/lib/less/js/lib/less/tree/assignment.js +17 -0
- data/lib/less/js/lib/less/tree/call.js +7 -4
- data/lib/less/js/lib/less/tree/color.js +9 -6
- data/lib/less/js/lib/less/tree/comment.js +1 -1
- data/lib/less/js/lib/less/tree/condition.js +42 -0
- data/lib/less/js/lib/less/tree/dimension.js +16 -1
- data/lib/less/js/lib/less/tree/directive.js +4 -2
- data/lib/less/js/lib/less/tree/element.js +20 -5
- data/lib/less/js/lib/less/tree/expression.js +2 -2
- data/lib/less/js/lib/less/tree/import.js +16 -14
- data/lib/less/js/lib/less/tree/javascript.js +1 -1
- data/lib/less/js/lib/less/tree/keyword.js +12 -2
- data/lib/less/js/lib/less/tree/media.js +114 -0
- data/lib/less/js/lib/less/tree/mixin.js +49 -20
- data/lib/less/js/lib/less/tree/operation.js +1 -1
- data/lib/less/js/lib/less/tree/paren.js +16 -0
- data/lib/less/js/lib/less/tree/quoted.js +2 -2
- data/lib/less/js/lib/less/tree/rule.js +8 -4
- data/lib/less/js/lib/less/tree/ruleset.js +49 -12
- data/lib/less/js/lib/less/tree/selector.js +18 -4
- data/lib/less/js/lib/less/tree/url.js +2 -2
- data/lib/less/js/lib/less/tree/value.js +1 -1
- data/lib/less/js/lib/less/tree/variable.js +5 -3
- data/lib/less/js/lib/less/tree.js +6 -2
- data/lib/less/js/package.json +2 -2
- data/lib/less/js/test/css/colors.css +16 -0
- data/lib/less/js/test/css/comments.css +9 -5
- data/lib/less/js/test/css/css-3.css +18 -2
- data/lib/less/js/test/css/css-escapes.css +1 -1
- data/lib/less/js/test/css/css.css +11 -4
- data/lib/less/js/test/css/functions.css +13 -0
- data/lib/less/js/test/css/ie-filters.css +5 -0
- data/lib/less/js/test/css/import.css +12 -3
- data/lib/less/js/test/css/media.css +60 -2
- data/lib/less/js/test/css/mixins-args.css +17 -2
- data/lib/less/js/test/css/mixins-guards.css +58 -0
- data/lib/less/js/test/css/mixins-important.css +17 -0
- data/lib/less/js/test/css/mixins-pattern.css +4 -6
- data/lib/less/js/test/css/mixins.css +21 -0
- data/lib/less/js/test/css/operations.css +3 -0
- data/lib/less/js/test/css/parens.css +1 -1
- data/lib/less/js/test/css/rulesets.css +6 -2
- data/lib/less/js/test/css/scope.css +6 -6
- data/lib/less/js/test/css/selectors.css +38 -1
- data/lib/less/js/test/css/strings.css +6 -4
- data/lib/less/js/test/css/variables.css +3 -0
- data/lib/less/js/test/css/whitespace.css +5 -3
- data/lib/less/js/test/less/colors.less +19 -0
- data/lib/less/js/test/less/comments.less +8 -6
- data/lib/less/js/test/less/css-3.less +10 -0
- data/lib/less/js/test/less/css.less +4 -0
- data/lib/less/js/test/less/functions.less +15 -1
- data/lib/less/js/test/less/ie-filters.less +8 -0
- data/lib/less/js/test/less/import/import-test-e.less +2 -0
- data/lib/less/js/test/less/import.less +4 -1
- data/lib/less/js/test/less/media.less +55 -1
- data/lib/less/js/test/less/mixins-args.less +20 -1
- data/lib/less/js/test/less/mixins-guards.less +94 -0
- data/lib/less/js/test/less/mixins-important.less +18 -0
- data/lib/less/js/test/less/mixins-pattern.less +3 -0
- data/lib/less/js/test/less/mixins.less +20 -0
- data/lib/less/js/test/less/operations.less +4 -0
- data/lib/less/js/test/less/selectors.less +31 -0
- data/lib/less/js/test/less/strings.less +2 -0
- data/lib/less/js/test/less/variables.less +4 -0
- data/lib/less/js/test/less-test.js +3 -5
- data/lib/less/loader.rb +24 -25
- data/lib/less/parser.rb +32 -6
- data/lib/less/version.rb +1 -1
- data/lib/less.rb +7 -8
- data/spec/less/faulty/faulty.less +3 -0
- data/spec/less/parser_spec.rb +28 -2
- metadata +321 -149
data/.gitmodules
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/bin/lessc
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
require 'less'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
# This file is inspired by / based off of http://ozmm.org/posts/argf.html
|
|
6
|
+
|
|
7
|
+
def help
|
|
8
|
+
puts <<-help
|
|
9
|
+
Usage:
|
|
10
|
+
$ lessc < style.less
|
|
11
|
+
$ lessc file1.less file2.less
|
|
12
|
+
help
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# First off, let's show help some help if no arguments and tty
|
|
16
|
+
if ($stdin.tty? && ARGV.empty?) || ARGV.delete('-h') || ARGV.delete('--help')
|
|
17
|
+
help
|
|
18
|
+
else
|
|
19
|
+
# Well, lets read those files
|
|
20
|
+
doc = ARGF.read
|
|
21
|
+
parser = Less::Parser.new
|
|
22
|
+
tree = parser.parse(doc)
|
|
23
|
+
puts tree.to_css(:compress => true)
|
|
24
|
+
end
|
data/less.gemspec
CHANGED
|
@@ -21,9 +21,11 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
22
22
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
23
23
|
s.require_paths = ["lib"]
|
|
24
|
-
|
|
25
|
-
s.add_dependency "therubyracer", "~> 0.
|
|
26
|
-
s.
|
|
24
|
+
|
|
25
|
+
s.add_dependency "therubyracer", "~> 0.10.0"
|
|
26
|
+
s.add_dependency "commonjs", "~> 0.2.0"
|
|
27
|
+
|
|
28
|
+
s.add_development_dependency "rake"
|
|
27
29
|
s.add_development_dependency "rspec", "~> 2.0"
|
|
28
30
|
end
|
|
29
31
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
1.3.0
|
|
2
|
+
|
|
3
|
+
@media bubbling
|
|
4
|
+
Support arbitrary entities as selectors
|
|
5
|
+
Variadic argument support, see: https://gist.github.com/1933613
|
|
6
|
+
Behaviour of zero-arity mixins has changed, see link above.
|
|
7
|
+
Allow '@import' directives in any selector
|
|
8
|
+
Media-query features can now be a variable
|
|
9
|
+
Automatic merging of media-query conditions
|
|
10
|
+
Fix global variable leaks
|
|
11
|
+
Fix error message on wrong-arity call
|
|
12
|
+
Fix an '@arguments' behaviour bug
|
|
13
|
+
Fix '::' selector output
|
|
14
|
+
Fix a bug when using @media with mixins
|
|
15
|
+
|
|
16
|
+
1.2.1
|
|
17
|
+
|
|
18
|
+
Fix imports on browser
|
|
19
|
+
Improve error reporting on browser
|
|
20
|
+
Fix Runtime error reports from imported files
|
|
21
|
+
Fix 'File not found' import error reporting
|
|
22
|
+
|
|
23
|
+
1.2.0
|
|
24
|
+
|
|
25
|
+
Mixin guards
|
|
26
|
+
New function `percentage`
|
|
27
|
+
New `color` function to parse hex color strings
|
|
28
|
+
New type-checking stylesheet functions
|
|
29
|
+
Fix Rhino support
|
|
30
|
+
Fix bug in string arguments to mixin call
|
|
31
|
+
Fix error reporting when index is 0
|
|
32
|
+
Fix browser support in webkit and IE
|
|
33
|
+
Fix string interpolation bug when var is empty
|
|
34
|
+
Support '!important' after mixin calls
|
|
35
|
+
Support vanilla @keyframes directive
|
|
36
|
+
Support variables in certain css selectors, like 'nth-child'
|
|
37
|
+
Support @media and @import features properly
|
|
38
|
+
Improve @import support with media features
|
|
39
|
+
Improve error reports from imported files
|
|
40
|
+
Improve function call error reporting
|
|
41
|
+
Improve error-reporting
|
data/lib/less/js/Makefile
CHANGED
|
@@ -18,6 +18,7 @@ HEADER = build/header.js
|
|
|
18
18
|
VERSION = `cat package.json | grep version \
|
|
19
19
|
| grep -o '[0-9]\.[0-9]\.[0-9]\+'`
|
|
20
20
|
DIST = dist/less-${VERSION}.js
|
|
21
|
+
RHINO = dist/less-rhino-${VERSION}.js
|
|
21
22
|
DIST_MIN = dist/less-${VERSION}.min.js
|
|
22
23
|
|
|
23
24
|
less:
|
|
@@ -26,19 +27,37 @@ less:
|
|
|
26
27
|
@@cat ${HEADER} | sed s/@VERSION/${VERSION}/ > ${DIST}
|
|
27
28
|
@@echo "(function (window, undefined) {" >> ${DIST}
|
|
28
29
|
@@cat build/require.js\
|
|
30
|
+
build/amd.js\
|
|
29
31
|
build/ecma-5.js\
|
|
30
32
|
${SRC}/parser.js\
|
|
31
33
|
${SRC}/functions.js\
|
|
34
|
+
${SRC}/colors.js\
|
|
32
35
|
${SRC}/tree/*.js\
|
|
33
36
|
${SRC}/tree.js\
|
|
34
37
|
${SRC}/browser.js >> ${DIST}
|
|
35
38
|
@@echo "})(window);" >> ${DIST}
|
|
36
39
|
@@echo ${DIST} built.
|
|
37
40
|
|
|
41
|
+
rhino:
|
|
42
|
+
@@mkdir -p dist
|
|
43
|
+
@@touch ${RHINO}
|
|
44
|
+
@@cat build/require-rhino.js\
|
|
45
|
+
build/ecma-5.js\
|
|
46
|
+
${SRC}/parser.js\
|
|
47
|
+
${SRC}/functions.js\
|
|
48
|
+
${SRC}/tree/*.js\
|
|
49
|
+
${SRC}/tree.js\
|
|
50
|
+
${SRC}/rhino.js > ${RHINO}
|
|
51
|
+
@@echo ${RHINO} built.
|
|
52
|
+
|
|
38
53
|
min: less
|
|
39
54
|
@@echo minifying...
|
|
40
|
-
@@
|
|
41
|
-
@@
|
|
55
|
+
@@uglifyjs ${DIST} > ${DIST_MIN}
|
|
56
|
+
@@echo ${DIST_MIN} built.
|
|
57
|
+
|
|
58
|
+
server: less
|
|
59
|
+
cp dist/less-${VERSION}.js test/html/
|
|
60
|
+
cd test/html && python -m SimpleHTTPServer
|
|
42
61
|
|
|
43
62
|
clean:
|
|
44
63
|
git rm dist/*
|
|
@@ -11,27 +11,27 @@
|
|
|
11
11
|
@colour_positive: #ff0000;
|
|
12
12
|
@colour_negative: #ff0000;
|
|
13
13
|
|
|
14
|
-
.box_shadow () {
|
|
14
|
+
.box_shadow (...) {
|
|
15
15
|
}
|
|
16
|
-
.text_shadow () {
|
|
16
|
+
.text_shadow (...) {
|
|
17
17
|
}
|
|
18
|
-
.border_radius () {
|
|
18
|
+
.border_radius (...) {
|
|
19
19
|
}
|
|
20
|
-
.border_radius_top_left () {
|
|
20
|
+
.border_radius_top_left (...) {
|
|
21
21
|
}
|
|
22
|
-
.border_radius_top_right () {
|
|
22
|
+
.border_radius_top_right (...) {
|
|
23
23
|
}
|
|
24
|
-
.border_radius_bottom_right () {
|
|
24
|
+
.border_radius_bottom_right (...) {
|
|
25
25
|
}
|
|
26
|
-
.border_radius_bottom_left () {
|
|
26
|
+
.border_radius_bottom_left (...) {
|
|
27
27
|
}
|
|
28
|
-
.border_radius_top () {
|
|
28
|
+
.border_radius_top (...) {
|
|
29
29
|
}
|
|
30
|
-
.border_radius_right () {
|
|
30
|
+
.border_radius_right (...) {
|
|
31
31
|
}
|
|
32
|
-
.border_radius_bottom () {
|
|
32
|
+
.border_radius_bottom (...) {
|
|
33
33
|
}
|
|
34
|
-
.border_radius_left () {
|
|
34
|
+
.border_radius_left (...) {
|
|
35
35
|
}
|
|
36
36
|
div.browse {
|
|
37
37
|
margin: 0 0 20px;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
var path = require('path'),
|
|
2
2
|
fs = require('fs'),
|
|
3
|
-
sys = require('
|
|
3
|
+
sys = require('util');
|
|
4
4
|
|
|
5
|
-
require
|
|
6
|
-
|
|
7
|
-
var less = require('lib/less');
|
|
5
|
+
var less = require('../lib/less');
|
|
8
6
|
var file = path.join(__dirname, 'benchmark.less');
|
|
9
7
|
|
|
10
8
|
if (process.argv[2]) { file = path.join(process.cwd(), process.argv[2]) }
|
|
@@ -12,7 +10,7 @@ if (process.argv[2]) { file = path.join(process.cwd(), process.argv[2]) }
|
|
|
12
10
|
fs.readFile(file, 'utf8', function (e, data) {
|
|
13
11
|
var tree, css, start, end, total;
|
|
14
12
|
|
|
15
|
-
sys.puts("
|
|
13
|
+
sys.puts("Benchmarking...\n", path.basename(file) + " (" +
|
|
16
14
|
parseInt(data.length / 1024) + " KB)", "");
|
|
17
15
|
|
|
18
16
|
start = new(Date);
|
data/lib/less/js/bin/lessc
CHANGED
|
@@ -2,22 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
var path = require('path'),
|
|
4
4
|
fs = require('fs'),
|
|
5
|
-
sys = require('
|
|
5
|
+
sys = require('util'),
|
|
6
|
+
os = require('os');
|
|
6
7
|
|
|
7
|
-
require
|
|
8
|
-
|
|
9
|
-
var less = require('less');
|
|
8
|
+
var less = require('../lib/less');
|
|
10
9
|
var args = process.argv.slice(1);
|
|
11
10
|
var options = {
|
|
12
11
|
compress: false,
|
|
12
|
+
yuicompress: false,
|
|
13
13
|
optimization: 1,
|
|
14
14
|
silent: false,
|
|
15
|
-
paths: []
|
|
15
|
+
paths: [],
|
|
16
|
+
color: true,
|
|
17
|
+
strictImports: false
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
args = args.filter(function (arg) {
|
|
19
21
|
var match;
|
|
20
22
|
|
|
23
|
+
if (match = arg.match(/^-I(.+)$/)) {
|
|
24
|
+
options.paths.push(match[1]);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
21
28
|
if (match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=([^\s]+))?$/i)) { arg = match[1] }
|
|
22
29
|
else { return arg }
|
|
23
30
|
|
|
@@ -33,6 +40,9 @@ args = args.filter(function (arg) {
|
|
|
33
40
|
case 'silent':
|
|
34
41
|
options.silent = true;
|
|
35
42
|
break;
|
|
43
|
+
case 'strict-imports':
|
|
44
|
+
options.strictImports = true;
|
|
45
|
+
break;
|
|
36
46
|
case 'h':
|
|
37
47
|
case 'help':
|
|
38
48
|
sys.puts("usage: lessc source [destination]");
|
|
@@ -41,13 +51,17 @@ args = args.filter(function (arg) {
|
|
|
41
51
|
case 'compress':
|
|
42
52
|
options.compress = true;
|
|
43
53
|
break;
|
|
54
|
+
case 'yui-compress':
|
|
55
|
+
options.yuicompress = true;
|
|
56
|
+
break;
|
|
57
|
+
case 'no-color':
|
|
58
|
+
options.color = false;
|
|
59
|
+
break;
|
|
44
60
|
case 'include-path':
|
|
45
|
-
options.paths = match[2].split(':')
|
|
61
|
+
options.paths = match[2].split(os.type().match(/Windows/) ? ';' : ':')
|
|
46
62
|
.map(function(p) {
|
|
47
|
-
if (p
|
|
48
|
-
|
|
49
|
-
} else if (p) {
|
|
50
|
-
return path.join(process.cwd(), p);
|
|
63
|
+
if (p) {
|
|
64
|
+
return path.resolve(process.cwd(), p);
|
|
51
65
|
}
|
|
52
66
|
});
|
|
53
67
|
break;
|
|
@@ -58,12 +72,12 @@ args = args.filter(function (arg) {
|
|
|
58
72
|
});
|
|
59
73
|
|
|
60
74
|
var input = args[1];
|
|
61
|
-
if (input && input
|
|
62
|
-
input = path.
|
|
75
|
+
if (input && input != '-') {
|
|
76
|
+
input = path.resolve(process.cwd(), input);
|
|
63
77
|
}
|
|
64
78
|
var output = args[2];
|
|
65
|
-
if (output
|
|
66
|
-
output = path.
|
|
79
|
+
if (output) {
|
|
80
|
+
output = path.resolve(process.cwd(), output);
|
|
67
81
|
}
|
|
68
82
|
|
|
69
83
|
var css, fd, tree;
|
|
@@ -73,7 +87,7 @@ if (! input) {
|
|
|
73
87
|
process.exit(1);
|
|
74
88
|
}
|
|
75
89
|
|
|
76
|
-
|
|
90
|
+
var parseLessFile = function (e, data) {
|
|
77
91
|
if (e) {
|
|
78
92
|
sys.puts("lessc: " + e.message);
|
|
79
93
|
process.exit(1);
|
|
@@ -82,14 +96,18 @@ fs.readFile(input, 'utf-8', function (e, data) {
|
|
|
82
96
|
new(less.Parser)({
|
|
83
97
|
paths: [path.dirname(input)].concat(options.paths),
|
|
84
98
|
optimization: options.optimization,
|
|
85
|
-
filename: input
|
|
99
|
+
filename: input,
|
|
100
|
+
strictImports: options.strictImports
|
|
86
101
|
}).parse(data, function (err, tree) {
|
|
87
102
|
if (err) {
|
|
88
103
|
less.writeError(err, options);
|
|
89
104
|
process.exit(1);
|
|
90
105
|
} else {
|
|
91
106
|
try {
|
|
92
|
-
css = tree.toCSS({
|
|
107
|
+
css = tree.toCSS({
|
|
108
|
+
compress: options.compress,
|
|
109
|
+
yuicompress: options.yuicompress
|
|
110
|
+
});
|
|
93
111
|
if (output) {
|
|
94
112
|
fd = fs.openSync(output, "w");
|
|
95
113
|
fs.writeSync(fd, css, 0, "utf8");
|
|
@@ -102,4 +120,20 @@ fs.readFile(input, 'utf-8', function (e, data) {
|
|
|
102
120
|
}
|
|
103
121
|
}
|
|
104
122
|
});
|
|
105
|
-
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
if (input != '-') {
|
|
126
|
+
fs.readFile(input, 'utf-8', parseLessFile);
|
|
127
|
+
} else {
|
|
128
|
+
process.stdin.resume();
|
|
129
|
+
process.stdin.setEncoding('utf8');
|
|
130
|
+
|
|
131
|
+
var buffer = '';
|
|
132
|
+
process.stdin.on('data', function(data) {
|
|
133
|
+
buffer += data;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
process.stdin.on('end', function() {
|
|
137
|
+
parseLessFile(false, buffer);
|
|
138
|
+
});
|
|
139
|
+
}
|