stylus-source 0.15.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/README.md +3 -0
- data/lib/.DS_Store +0 -0
- data/lib/node_modules/cssom/.idea/CSSOM.iml +9 -0
- data/lib/node_modules/cssom/.idea/dictionaries/nv.xml +3 -0
- data/lib/node_modules/cssom/.idea/encodings.xml +5 -0
- data/lib/node_modules/cssom/.idea/misc.xml +17 -0
- data/lib/node_modules/cssom/.idea/modules.xml +9 -0
- data/lib/node_modules/cssom/.idea/projectCodeStyle.xml +82 -0
- data/lib/node_modules/cssom/.idea/vcs.xml +8 -0
- data/lib/node_modules/cssom/.idea/workspace.xml +467 -0
- data/lib/node_modules/cssom/.livereload +19 -0
- data/lib/node_modules/cssom/Jakefile +37 -0
- data/lib/node_modules/cssom/README.mdown +33 -0
- data/lib/node_modules/cssom/Rakefile +23 -0
- data/lib/node_modules/cssom/docs/.livereload +19 -0
- data/lib/node_modules/cssom/docs/bar.css +3 -0
- data/lib/node_modules/cssom/docs/demo.css +0 -0
- data/lib/node_modules/cssom/docs/foo.css +4 -0
- data/lib/node_modules/cssom/docs/parse.html +170 -0
- data/lib/node_modules/cssom/docs/parse2.html +431 -0
- data/lib/node_modules/cssom/index.html +100 -0
- data/lib/node_modules/cssom/lib/CSSImportRule.js +34 -0
- data/lib/node_modules/cssom/lib/CSSMediaRule.js +38 -0
- data/lib/node_modules/cssom/lib/CSSOM.js +3 -0
- data/lib/node_modules/cssom/lib/CSSRule.js +38 -0
- data/lib/node_modules/cssom/lib/CSSStyleDeclaration.js +130 -0
- data/lib/node_modules/cssom/lib/CSSStyleRule.js +187 -0
- data/lib/node_modules/cssom/lib/CSSStyleSheet.js +85 -0
- data/lib/node_modules/cssom/lib/MediaList.js +61 -0
- data/lib/node_modules/cssom/lib/StyleSheet.js +15 -0
- data/lib/node_modules/cssom/lib/clone.js +69 -0
- data/lib/node_modules/cssom/lib/index.js +10 -0
- data/lib/node_modules/cssom/lib/parse.js +195 -0
- data/lib/node_modules/cssom/media.html +17 -0
- data/lib/node_modules/cssom/package.json +30 -0
- data/lib/node_modules/cssom/plugins/toHTML.js +32 -0
- data/lib/node_modules/cssom/server/index.html +22 -0
- data/lib/node_modules/cssom/server/index.js +21 -0
- data/lib/node_modules/cssom/shorthands.html +21 -0
- data/lib/node_modules/cssom/test/CSSStyleDeclaration.test.js +35 -0
- data/lib/node_modules/cssom/test/CSSStyleRule.test.js +12 -0
- data/lib/node_modules/cssom/test/CSSStyleSheet.test.js +16 -0
- data/lib/node_modules/cssom/test/MediaList.test.js +21 -0
- data/lib/node_modules/cssom/test/clone.test.js +38 -0
- data/lib/node_modules/cssom/test/fixtures/dummy.css +3 -0
- data/lib/node_modules/cssom/test/helper.js +97 -0
- data/lib/node_modules/cssom/test/index.html +42 -0
- data/lib/node_modules/cssom/test/parse.test.js +346 -0
- data/lib/node_modules/cssom/test/vendor/qunit.css +189 -0
- data/lib/node_modules/cssom/test/vendor/qunit.js +1341 -0
- data/lib/node_modules/growl/History.md +16 -0
- data/lib/node_modules/growl/Readme.md +74 -0
- data/lib/node_modules/growl/lib/growl.js +82 -0
- data/lib/node_modules/growl/package.json +6 -0
- data/lib/node_modules/growl/test.js +17 -0
- data/lib/stylus/colors.js +156 -0
- data/lib/stylus/convert/css.js +130 -0
- data/lib/stylus/errors.js +58 -0
- data/lib/stylus/functions/image.js +120 -0
- data/lib/stylus/functions/index.js +722 -0
- data/lib/stylus/functions/index.styl +123 -0
- data/lib/stylus/functions/url.js +98 -0
- data/lib/stylus/lexer.js +728 -0
- data/lib/stylus/middleware.js +223 -0
- data/lib/stylus/nodes/arguments.js +65 -0
- data/lib/stylus/nodes/binop.js +54 -0
- data/lib/stylus/nodes/block.js +99 -0
- data/lib/stylus/nodes/boolean.js +103 -0
- data/lib/stylus/nodes/call.js +57 -0
- data/lib/stylus/nodes/charset.js +42 -0
- data/lib/stylus/nodes/comment.js +32 -0
- data/lib/stylus/nodes/each.js +56 -0
- data/lib/stylus/nodes/expression.js +168 -0
- data/lib/stylus/nodes/fontface.js +55 -0
- data/lib/stylus/nodes/function.js +104 -0
- data/lib/stylus/nodes/group.js +79 -0
- data/lib/stylus/nodes/hsla.js +256 -0
- data/lib/stylus/nodes/ident.js +127 -0
- data/lib/stylus/nodes/if.js +55 -0
- data/lib/stylus/nodes/import.js +30 -0
- data/lib/stylus/nodes/index.js +52 -0
- data/lib/stylus/nodes/jsliteral.js +32 -0
- data/lib/stylus/nodes/keyframes.js +78 -0
- data/lib/stylus/nodes/literal.js +92 -0
- data/lib/stylus/nodes/media.js +42 -0
- data/lib/stylus/nodes/node.js +209 -0
- data/lib/stylus/nodes/null.js +72 -0
- data/lib/stylus/nodes/page.js +43 -0
- data/lib/stylus/nodes/params.js +72 -0
- data/lib/stylus/nodes/property.js +72 -0
- data/lib/stylus/nodes/return.js +44 -0
- data/lib/stylus/nodes/rgba.js +335 -0
- data/lib/stylus/nodes/root.js +50 -0
- data/lib/stylus/nodes/selector.js +57 -0
- data/lib/stylus/nodes/string.js +120 -0
- data/lib/stylus/nodes/ternary.js +51 -0
- data/lib/stylus/nodes/unaryop.js +46 -0
- data/lib/stylus/nodes/unit.js +207 -0
- data/lib/stylus/parser.js +1514 -0
- data/lib/stylus/renderer.js +157 -0
- data/lib/stylus/source.rb +7 -0
- data/lib/stylus/stack/frame.js +66 -0
- data/lib/stylus/stack/index.js +146 -0
- data/lib/stylus/stack/scope.js +53 -0
- data/lib/stylus/stylus.js +102 -0
- data/lib/stylus/token.js +53 -0
- data/lib/stylus/utils.js +237 -0
- data/lib/stylus/visitor/compiler.js +472 -0
- data/lib/stylus/visitor/evaluator.js +1070 -0
- data/lib/stylus/visitor/index.js +31 -0
- data/stylus-source.gemspec +15 -0
- metadata +158 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
1.1.0 / 2011-03-15
|
3
|
+
==================
|
4
|
+
|
5
|
+
* Added optional callbacks
|
6
|
+
* Added parsing of version
|
7
|
+
|
8
|
+
1.0.1 / 2010-03-26
|
9
|
+
==================
|
10
|
+
|
11
|
+
* Fixed; sys.exec -> child_process.exec to support latest node
|
12
|
+
|
13
|
+
1.0.0 / 2010-03-19
|
14
|
+
==================
|
15
|
+
|
16
|
+
* Initial release
|
@@ -0,0 +1,74 @@
|
|
1
|
+
|
2
|
+
# Growl for nodejs
|
3
|
+
|
4
|
+
Growl support for Nodejs. This is essentially a port of my [Ruby Growl Library](http://github.com/visionmedia/growl).
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Install the [Kiwi package manager for nodejs](http://github.com/visionmedia/kiwi)
|
9
|
+
and run:
|
10
|
+
|
11
|
+
$ kiwi -v install growl
|
12
|
+
|
13
|
+
## Examples
|
14
|
+
|
15
|
+
Callback functions are optional
|
16
|
+
|
17
|
+
var growl = require('growl')
|
18
|
+
growl.notify('You have mail!')
|
19
|
+
growl.notify('5 new messages', { sticky: true })
|
20
|
+
growl.notify('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
|
21
|
+
growl.notify('Show Safari icon', { image: 'Safari' })
|
22
|
+
growl.notify('Show icon', { image: 'path/to/icon.icns' })
|
23
|
+
growl.notify('Show image', { image: 'path/to/my.image.png' })
|
24
|
+
growl.notify('Show png filesystem icon', { image: 'png' })
|
25
|
+
growl.notify('Show pdf filesystem icon', { image: 'article.pdf' })
|
26
|
+
growl.notify('Show pdf filesystem icon', { image: 'article.pdf' }, function(){
|
27
|
+
// ... notified
|
28
|
+
})
|
29
|
+
|
30
|
+
## Options
|
31
|
+
|
32
|
+
- title
|
33
|
+
- notification title
|
34
|
+
- name
|
35
|
+
- application name
|
36
|
+
- sticky
|
37
|
+
- weither or not the notification should remainin until closed
|
38
|
+
- image
|
39
|
+
- Auto-detects the context:
|
40
|
+
- path to an icon sets --iconpath
|
41
|
+
- path to an image sets --image
|
42
|
+
- capitalized word sets --appIcon
|
43
|
+
- filename uses extname as --icon
|
44
|
+
- otherwise treated as --icon
|
45
|
+
|
46
|
+
Fetch the current version of 'growlnotify':
|
47
|
+
|
48
|
+
growl.binVersion(function(err, version){ ... })
|
49
|
+
// => 'n.n.n'
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
(The MIT License)
|
54
|
+
|
55
|
+
Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
|
56
|
+
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
58
|
+
a copy of this software and associated documentation files (the
|
59
|
+
'Software'), to deal in the Software without restriction, including
|
60
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
61
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
62
|
+
permit persons to whom the Software is furnished to do so, subject to
|
63
|
+
the following conditions:
|
64
|
+
|
65
|
+
The above copyright notice and this permission notice shall be
|
66
|
+
included in all copies or substantial portions of the Software.
|
67
|
+
|
68
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
69
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
70
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
71
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
72
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
73
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
74
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
// Growl - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Module dependencies.
|
6
|
+
*/
|
7
|
+
|
8
|
+
var exec = require('child_process').exec
|
9
|
+
, path = require('path');
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Node-growl version.
|
13
|
+
*/
|
14
|
+
|
15
|
+
exports.version = '1.1.0'
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Fetch the binary version when available.
|
19
|
+
*
|
20
|
+
* @param {function} fn
|
21
|
+
* @api public
|
22
|
+
*/
|
23
|
+
|
24
|
+
exports.binVersion = function(fn) {
|
25
|
+
exec('growlnotify -v', function(err, stdout){
|
26
|
+
if (err) return fn(err);
|
27
|
+
var version = /(\d+\.\d+(?:\.\d+)?)/.exec(stdout)[1];
|
28
|
+
fn(null, parseFloat(version));
|
29
|
+
});
|
30
|
+
};
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Send growl notification _msg_ with _options_.
|
34
|
+
*
|
35
|
+
* Options:
|
36
|
+
*
|
37
|
+
* - title Notification title
|
38
|
+
* - sticky Make the notification stick (defaults to false)
|
39
|
+
* - name Application name (defaults to growlnotify)
|
40
|
+
* - image
|
41
|
+
* - path to an icon sets --iconpath
|
42
|
+
* - path to an image sets --image
|
43
|
+
* - capitalized word sets --appIcon
|
44
|
+
* - filename uses extname as --icon
|
45
|
+
* - otherwise treated as --icon
|
46
|
+
*
|
47
|
+
* Examples:
|
48
|
+
*
|
49
|
+
* growl.notify('New email')
|
50
|
+
* growl.notify('5 new emails', { title: 'Thunderbird' })
|
51
|
+
* growl.notify('Email sent', function(){
|
52
|
+
* // ... notification sent
|
53
|
+
* })
|
54
|
+
*
|
55
|
+
* @param {string} msg
|
56
|
+
* @param {object} options
|
57
|
+
* @param {function} fn
|
58
|
+
* @api public
|
59
|
+
*/
|
60
|
+
|
61
|
+
exports.notify = function(msg, options, fn) {
|
62
|
+
var image
|
63
|
+
, args = ['growlnotify', '-m', '"' + msg + '"']
|
64
|
+
, options = options || {}
|
65
|
+
, fn = fn || function(){};
|
66
|
+
exports.binVersion(function(err, version){
|
67
|
+
if (err) return fn(err);
|
68
|
+
if (image = options.image) {
|
69
|
+
var flag, ext = path.extname(image).substr(1)
|
70
|
+
flag = flag || ext == 'icns' && 'iconpath'
|
71
|
+
flag = flag || /^[A-Z]/.test(image) && 'appIcon'
|
72
|
+
flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image'
|
73
|
+
flag = flag || ext && (image = ext) && 'icon'
|
74
|
+
flag = flag || 'icon'
|
75
|
+
args.push('--' + flag, image)
|
76
|
+
}
|
77
|
+
if (options.sticky) args.push('--sticky');
|
78
|
+
if (options.name) args.push('--name', options.name);
|
79
|
+
if (options.title) args.push(options.title);
|
80
|
+
exec(args.join(' '), fn);
|
81
|
+
});
|
82
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
var growl = require('./lib/growl')
|
3
|
+
|
4
|
+
growl.binVersion(function(err, version){
|
5
|
+
console.log(version);
|
6
|
+
})
|
7
|
+
growl.notify('You have mail!')
|
8
|
+
growl.notify('5 new messages', { sticky: true })
|
9
|
+
growl.notify('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
|
10
|
+
growl.notify('Show Safari icon', { image: 'Safari' })
|
11
|
+
growl.notify('Show icon', { image: 'path/to/icon.icns' })
|
12
|
+
growl.notify('Show image', { image: 'path/to/my.image.png' })
|
13
|
+
growl.notify('Show png filesystem icon', { image: 'png' })
|
14
|
+
growl.notify('Show pdf filesystem icon', { image: 'article.pdf' })
|
15
|
+
growl.notify('Show pdf filesystem icon', { image: 'article.pdf' }, function(){
|
16
|
+
require('sys').p('callback')
|
17
|
+
})
|
@@ -0,0 +1,156 @@
|
|
1
|
+
|
2
|
+
/*!
|
3
|
+
* Stylus - colors
|
4
|
+
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
|
5
|
+
* MIT Licensed
|
6
|
+
*/
|
7
|
+
|
8
|
+
module.exports = {
|
9
|
+
aliceblue: [240, 248, 255]
|
10
|
+
, antiquewhite: [250, 235, 215]
|
11
|
+
, aqua: [0, 255, 255]
|
12
|
+
, aquamarine: [127, 255, 212]
|
13
|
+
, azure: [240, 255, 255]
|
14
|
+
, beige: [245, 245, 220]
|
15
|
+
, bisque: [255, 228, 196]
|
16
|
+
, black: [0, 0, 0]
|
17
|
+
, blanchedalmond: [255, 235, 205]
|
18
|
+
, blue: [0, 0, 255]
|
19
|
+
, blueviolet: [138, 43, 226]
|
20
|
+
, brown: [165, 42, 42]
|
21
|
+
, burlywood: [222, 184, 135]
|
22
|
+
, cadetblue: [95, 158, 160]
|
23
|
+
, chartreuse: [127, 255, 0]
|
24
|
+
, chocolate: [210, 105, 30]
|
25
|
+
, coral: [255, 127, 80]
|
26
|
+
, cornflowerblue: [100, 149, 237]
|
27
|
+
, cornsilk: [255, 248, 220]
|
28
|
+
, crimson: [220, 20, 60]
|
29
|
+
, cyan: [0, 255, 255]
|
30
|
+
, darkblue: [0, 0, 139]
|
31
|
+
, darkcyan: [0, 139, 139]
|
32
|
+
, darkgoldenrod: [184, 132, 11]
|
33
|
+
, darkgray: [169, 169, 169]
|
34
|
+
, darkgreen: [0, 100, 0]
|
35
|
+
, darkgrey: [169, 169, 169]
|
36
|
+
, darkkhaki: [189, 183, 107]
|
37
|
+
, darkmagenta: [139, 0, 139]
|
38
|
+
, darkolivegreen: [85, 107, 47]
|
39
|
+
, darkorange: [255, 140, 0]
|
40
|
+
, darkorchid: [153, 50, 204]
|
41
|
+
, darkred: [139, 0, 0]
|
42
|
+
, darksalmon: [233, 150, 122]
|
43
|
+
, darkseagreen: [143, 188, 143]
|
44
|
+
, darkslateblue: [72, 61, 139]
|
45
|
+
, darkslategray: [47, 79, 79]
|
46
|
+
, darkslategrey: [47, 79, 79]
|
47
|
+
, darkturquoise: [0, 206, 209]
|
48
|
+
, darkviolet: [148, 0, 211]
|
49
|
+
, deeppink: [255, 20, 147]
|
50
|
+
, deepskyblue: [0, 191, 255]
|
51
|
+
, dimgray: [105, 105, 105]
|
52
|
+
, dimgrey: [105, 105, 105]
|
53
|
+
, dodgerblue: [30, 144, 255]
|
54
|
+
, firebrick: [178, 34, 34]
|
55
|
+
, floralwhite: [255, 255, 240]
|
56
|
+
, forestgreen: [34, 139, 34]
|
57
|
+
, fuchsia: [255, 0, 255]
|
58
|
+
, gainsboro: [220, 220, 220]
|
59
|
+
, ghostwhite: [248, 248, 255]
|
60
|
+
, gold: [255, 215, 0]
|
61
|
+
, goldenrod: [218, 165, 32]
|
62
|
+
, gray: [128, 128, 128]
|
63
|
+
, green: [0, 128, 0]
|
64
|
+
, greenyellow: [173, 255, 47]
|
65
|
+
, grey: [128, 128, 128]
|
66
|
+
, honeydew: [240, 255, 240]
|
67
|
+
, hotpink: [255, 105, 180]
|
68
|
+
, indianred: [205, 92, 92]
|
69
|
+
, indigo: [75, 0, 130]
|
70
|
+
, ivory: [255, 255, 240]
|
71
|
+
, khaki: [240, 230, 140]
|
72
|
+
, lavender: [230, 230, 250]
|
73
|
+
, lavenderblush: [255, 240, 245]
|
74
|
+
, lawngreen: [124, 252, 0]
|
75
|
+
, lemonchiffon: [255, 250, 205]
|
76
|
+
, lightblue: [173, 216, 230]
|
77
|
+
, lightcoral: [240, 128, 128]
|
78
|
+
, lightcyan: [224, 255, 255]
|
79
|
+
, lightgoldenrodyellow: [250, 250, 210]
|
80
|
+
, lightgray: [211, 211, 211]
|
81
|
+
, lightgreen: [144, 238, 144]
|
82
|
+
, lightgrey: [211, 211, 211]
|
83
|
+
, lightpink: [255, 182, 193]
|
84
|
+
, lightsalmon: [255, 160, 122]
|
85
|
+
, lightseagreen: [32, 178, 170]
|
86
|
+
, lightskyblue: [135, 206, 250]
|
87
|
+
, lightslategray: [119, 136, 153]
|
88
|
+
, lightslategrey: [119, 136, 153]
|
89
|
+
, lightsteelblue: [176, 196, 222]
|
90
|
+
, lightyellow: [255, 255, 224]
|
91
|
+
, lime: [0, 255, 0]
|
92
|
+
, limegreen: [50, 205, 50]
|
93
|
+
, linen: [250, 240, 230]
|
94
|
+
, magenta: [255, 0, 255]
|
95
|
+
, maroon: [128, 0, 0]
|
96
|
+
, mediumaquamarine: [102, 205, 170]
|
97
|
+
, mediumblue: [0, 0, 205]
|
98
|
+
, mediumorchid: [186, 85, 211]
|
99
|
+
, mediumpurple: [147, 112, 219]
|
100
|
+
, mediumseagreen: [60, 179, 113]
|
101
|
+
, mediumslateblue: [123, 104, 238]
|
102
|
+
, mediumspringgreen: [0, 250, 154]
|
103
|
+
, mediumturquoise: [72, 209, 204]
|
104
|
+
, mediumvioletred: [199, 21, 133]
|
105
|
+
, midnightblue: [25, 25, 112]
|
106
|
+
, mintcream: [245, 255, 250]
|
107
|
+
, mistyrose: [255, 228, 225]
|
108
|
+
, moccasin: [255, 228, 181]
|
109
|
+
, navajowhite: [255, 222, 173]
|
110
|
+
, navy: [0, 0, 128]
|
111
|
+
, oldlace: [253, 245, 230]
|
112
|
+
, olive: [128, 128, 0]
|
113
|
+
, olivedrab: [107, 142, 35]
|
114
|
+
, orange: [255, 165, 0]
|
115
|
+
, orangered: [255, 69, 0]
|
116
|
+
, orchid: [218, 112, 214]
|
117
|
+
, palegoldenrod: [238, 232, 170]
|
118
|
+
, palegreen: [152, 251, 152]
|
119
|
+
, paleturquoise: [175, 238, 238]
|
120
|
+
, palevioletred: [219, 112, 147]
|
121
|
+
, papayawhip: [255, 239, 213]
|
122
|
+
, peachpuff: [255, 218, 185]
|
123
|
+
, peru: [205, 133, 63]
|
124
|
+
, pink: [255, 192, 203]
|
125
|
+
, plum: [221, 160, 203]
|
126
|
+
, powderblue: [176, 224, 230]
|
127
|
+
, purple: [128, 0, 128]
|
128
|
+
, red: [255, 0, 0]
|
129
|
+
, rosybrown: [188, 143, 143]
|
130
|
+
, royalblue: [65, 105, 225]
|
131
|
+
, saddlebrown: [139, 69, 19]
|
132
|
+
, salmon: [250, 128, 114]
|
133
|
+
, sandybrown: [244, 164, 96]
|
134
|
+
, seagreen: [46, 139, 87]
|
135
|
+
, seashell: [255, 245, 238]
|
136
|
+
, sienna: [160, 82, 45]
|
137
|
+
, silver: [192, 192, 192]
|
138
|
+
, skyblue: [135, 206, 235]
|
139
|
+
, slateblue: [106, 90, 205]
|
140
|
+
, slategray: [119, 128, 144]
|
141
|
+
, slategrey: [119, 128, 144]
|
142
|
+
, snow: [255, 255, 250]
|
143
|
+
, springgreen: [0, 255, 127]
|
144
|
+
, steelblue: [70, 130, 180]
|
145
|
+
, tan: [210, 180, 140]
|
146
|
+
, teal: [0, 128, 128]
|
147
|
+
, thistle: [216, 191, 216]
|
148
|
+
, tomato: [255, 99, 71]
|
149
|
+
, turquoise: [64, 224, 208]
|
150
|
+
, violet: [238, 130, 238]
|
151
|
+
, wheat: [245, 222, 179]
|
152
|
+
, white: [255, 255, 255]
|
153
|
+
, whitesmoke: [245, 245, 245]
|
154
|
+
, yellow: [255, 255, 0]
|
155
|
+
, yellowgreen: [154, 205, 5]
|
156
|
+
};
|
@@ -0,0 +1,130 @@
|
|
1
|
+
|
2
|
+
/*!
|
3
|
+
* Stylus - css to stylus conversion
|
4
|
+
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
|
5
|
+
* MIT Licensed
|
6
|
+
*/
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Convert the given `css` to stylus source.
|
10
|
+
*
|
11
|
+
* @param {String} css
|
12
|
+
* @return {String}
|
13
|
+
* @api public
|
14
|
+
*/
|
15
|
+
|
16
|
+
module.exports = function(css){
|
17
|
+
return new Converter(css).stylus();
|
18
|
+
};
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Initialize a new `Converter` with the given `css`.
|
22
|
+
*
|
23
|
+
* @param {String} css
|
24
|
+
* @api private
|
25
|
+
*/
|
26
|
+
|
27
|
+
function Converter(css) {
|
28
|
+
var cssom = require('cssom');
|
29
|
+
this.css = css;
|
30
|
+
this.types = cssom.CSSRule;
|
31
|
+
this.root = cssom.parse(css);
|
32
|
+
this.indents = 0;
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Convert to stylus.
|
37
|
+
*
|
38
|
+
* @return {String}
|
39
|
+
* @api private
|
40
|
+
*/
|
41
|
+
|
42
|
+
Converter.prototype.stylus = function(){
|
43
|
+
return this.visitRules(this.root.cssRules);
|
44
|
+
};
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Return indent string.
|
48
|
+
*
|
49
|
+
* @return {String}
|
50
|
+
* @api private
|
51
|
+
*/
|
52
|
+
|
53
|
+
Converter.prototype.__defineGetter__('indent', function(){
|
54
|
+
return Array(this.indents + 1).join(' ');
|
55
|
+
});
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Visit `node`.
|
59
|
+
*
|
60
|
+
* @param {CSSRule} node
|
61
|
+
* @return {String}
|
62
|
+
* @api private
|
63
|
+
*/
|
64
|
+
|
65
|
+
Converter.prototype.visit = function(node){
|
66
|
+
switch (node.type) {
|
67
|
+
case this.types.STYLE_RULE:
|
68
|
+
return this.visitStyle(node);
|
69
|
+
case this.types.MEDIA_RULE:
|
70
|
+
return this.visitMedia(node);
|
71
|
+
}
|
72
|
+
};
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Visit the rules on `node`.
|
76
|
+
*
|
77
|
+
* @param {CSSRule} node
|
78
|
+
* @return {String}
|
79
|
+
* @api private
|
80
|
+
*/
|
81
|
+
|
82
|
+
Converter.prototype.visitRules = function(node){
|
83
|
+
var buf = '';
|
84
|
+
for (var i = 0, len = node.length; i < len; ++i) {
|
85
|
+
buf += this.visit(node[i]);
|
86
|
+
}
|
87
|
+
return buf;
|
88
|
+
};
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Visit CSSMediaRule `node`.
|
92
|
+
*
|
93
|
+
* @param {CSSMediaRule} node
|
94
|
+
* @return {String}
|
95
|
+
* @api private
|
96
|
+
*/
|
97
|
+
|
98
|
+
Converter.prototype.visitMedia = function(node){
|
99
|
+
var buf = this.indent + '@media ';
|
100
|
+
for (var i = 0, len = node.media.length; i < len; ++i) {
|
101
|
+
buf += node.media[i];
|
102
|
+
}
|
103
|
+
buf += '\n';
|
104
|
+
++this.indents;
|
105
|
+
buf += this.visitRules(node.cssRules);
|
106
|
+
--this.indents;
|
107
|
+
return buf;
|
108
|
+
};
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Visit CSSStyleRule `node`.`
|
112
|
+
*
|
113
|
+
* @param {CSSStyleRule} node
|
114
|
+
* @return {String}
|
115
|
+
* @api private
|
116
|
+
*/
|
117
|
+
|
118
|
+
Converter.prototype.visitStyle = function(node){
|
119
|
+
var buf = this.indent + node.selectorText + '\n';
|
120
|
+
++this.indents;
|
121
|
+
for (var i = 0, len = node.style.length; i < len; ++i) {
|
122
|
+
var prop = node.style[i]
|
123
|
+
, val = node.style[prop];
|
124
|
+
if (prop) {
|
125
|
+
buf += this.indent + prop + ': ' + val + '\n';
|
126
|
+
}
|
127
|
+
}
|
128
|
+
--this.indents;
|
129
|
+
return buf + '\n';
|
130
|
+
};
|