xass 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gemfile +9 -0
  4. data/Gemfile.lock +39 -0
  5. data/README.md +131 -193
  6. data/lib/initialize.rb +8 -0
  7. data/lib/xass.rb +67 -0
  8. data/spec/secrets.yml +4 -0
  9. data/spec/spec_helper.rb +8 -0
  10. data/spec/test_spec.rb +5 -0
  11. data/template/secrets.yml +2 -0
  12. data/xass.gemspec +15 -0
  13. metadata +53 -294
  14. data/.yardopts +0 -11
  15. data/CONTRIBUTING +0 -3
  16. data/MIT-LICENSE +0 -20
  17. data/Rakefile +0 -349
  18. data/VERSION +0 -1
  19. data/VERSION_NAME +0 -1
  20. data/bin/push +0 -13
  21. data/bin/sass +0 -13
  22. data/bin/sass-convert +0 -12
  23. data/bin/scss +0 -13
  24. data/extra/update_watch.rb +0 -13
  25. data/init.rb +0 -18
  26. data/lib/sass/cache_stores/base.rb +0 -88
  27. data/lib/sass/cache_stores/chain.rb +0 -33
  28. data/lib/sass/cache_stores/filesystem.rb +0 -64
  29. data/lib/sass/cache_stores/memory.rb +0 -47
  30. data/lib/sass/cache_stores/null.rb +0 -25
  31. data/lib/sass/cache_stores.rb +0 -15
  32. data/lib/sass/callbacks.rb +0 -66
  33. data/lib/sass/css.rb +0 -409
  34. data/lib/sass/engine.rb +0 -930
  35. data/lib/sass/environment.rb +0 -101
  36. data/lib/sass/error.rb +0 -201
  37. data/lib/sass/exec.rb +0 -707
  38. data/lib/sass/importers/base.rb +0 -139
  39. data/lib/sass/importers/filesystem.rb +0 -186
  40. data/lib/sass/importers.rb +0 -22
  41. data/lib/sass/logger/base.rb +0 -32
  42. data/lib/sass/logger/log_level.rb +0 -49
  43. data/lib/sass/logger.rb +0 -15
  44. data/lib/sass/media.rb +0 -213
  45. data/lib/sass/plugin/compiler.rb +0 -406
  46. data/lib/sass/plugin/configuration.rb +0 -123
  47. data/lib/sass/plugin/generic.rb +0 -15
  48. data/lib/sass/plugin/merb.rb +0 -48
  49. data/lib/sass/plugin/rack.rb +0 -60
  50. data/lib/sass/plugin/rails.rb +0 -47
  51. data/lib/sass/plugin/staleness_checker.rb +0 -199
  52. data/lib/sass/plugin.rb +0 -133
  53. data/lib/sass/railtie.rb +0 -10
  54. data/lib/sass/repl.rb +0 -57
  55. data/lib/sass/root.rb +0 -7
  56. data/lib/sass/script/arg_list.rb +0 -52
  57. data/lib/sass/script/bool.rb +0 -18
  58. data/lib/sass/script/color.rb +0 -606
  59. data/lib/sass/script/css_lexer.rb +0 -29
  60. data/lib/sass/script/css_parser.rb +0 -31
  61. data/lib/sass/script/funcall.rb +0 -245
  62. data/lib/sass/script/functions.rb +0 -1543
  63. data/lib/sass/script/interpolation.rb +0 -79
  64. data/lib/sass/script/lexer.rb +0 -345
  65. data/lib/sass/script/list.rb +0 -85
  66. data/lib/sass/script/literal.rb +0 -221
  67. data/lib/sass/script/node.rb +0 -99
  68. data/lib/sass/script/null.rb +0 -37
  69. data/lib/sass/script/number.rb +0 -453
  70. data/lib/sass/script/operation.rb +0 -110
  71. data/lib/sass/script/parser.rb +0 -502
  72. data/lib/sass/script/string.rb +0 -51
  73. data/lib/sass/script/string_interpolation.rb +0 -103
  74. data/lib/sass/script/unary_operation.rb +0 -69
  75. data/lib/sass/script/variable.rb +0 -58
  76. data/lib/sass/script.rb +0 -39
  77. data/lib/sass/scss/css_parser.rb +0 -36
  78. data/lib/sass/scss/parser.rb +0 -1180
  79. data/lib/sass/scss/rx.rb +0 -133
  80. data/lib/sass/scss/script_lexer.rb +0 -15
  81. data/lib/sass/scss/script_parser.rb +0 -25
  82. data/lib/sass/scss/static_parser.rb +0 -54
  83. data/lib/sass/scss.rb +0 -16
  84. data/lib/sass/selector/abstract_sequence.rb +0 -94
  85. data/lib/sass/selector/comma_sequence.rb +0 -92
  86. data/lib/sass/selector/sequence.rb +0 -507
  87. data/lib/sass/selector/simple.rb +0 -119
  88. data/lib/sass/selector/simple_sequence.rb +0 -215
  89. data/lib/sass/selector.rb +0 -452
  90. data/lib/sass/shared.rb +0 -76
  91. data/lib/sass/supports.rb +0 -229
  92. data/lib/sass/tree/charset_node.rb +0 -22
  93. data/lib/sass/tree/comment_node.rb +0 -82
  94. data/lib/sass/tree/content_node.rb +0 -9
  95. data/lib/sass/tree/css_import_node.rb +0 -60
  96. data/lib/sass/tree/debug_node.rb +0 -18
  97. data/lib/sass/tree/directive_node.rb +0 -42
  98. data/lib/sass/tree/each_node.rb +0 -24
  99. data/lib/sass/tree/extend_node.rb +0 -36
  100. data/lib/sass/tree/for_node.rb +0 -36
  101. data/lib/sass/tree/function_node.rb +0 -34
  102. data/lib/sass/tree/if_node.rb +0 -52
  103. data/lib/sass/tree/import_node.rb +0 -75
  104. data/lib/sass/tree/media_node.rb +0 -58
  105. data/lib/sass/tree/mixin_def_node.rb +0 -38
  106. data/lib/sass/tree/mixin_node.rb +0 -39
  107. data/lib/sass/tree/node.rb +0 -196
  108. data/lib/sass/tree/prop_node.rb +0 -152
  109. data/lib/sass/tree/return_node.rb +0 -18
  110. data/lib/sass/tree/root_node.rb +0 -78
  111. data/lib/sass/tree/rule_node.rb +0 -132
  112. data/lib/sass/tree/supports_node.rb +0 -51
  113. data/lib/sass/tree/trace_node.rb +0 -32
  114. data/lib/sass/tree/variable_node.rb +0 -30
  115. data/lib/sass/tree/visitors/base.rb +0 -75
  116. data/lib/sass/tree/visitors/check_nesting.rb +0 -147
  117. data/lib/sass/tree/visitors/convert.rb +0 -316
  118. data/lib/sass/tree/visitors/cssize.rb +0 -241
  119. data/lib/sass/tree/visitors/deep_copy.rb +0 -102
  120. data/lib/sass/tree/visitors/extend.rb +0 -68
  121. data/lib/sass/tree/visitors/perform.rb +0 -446
  122. data/lib/sass/tree/visitors/set_options.rb +0 -125
  123. data/lib/sass/tree/visitors/to_css.rb +0 -228
  124. data/lib/sass/tree/warn_node.rb +0 -18
  125. data/lib/sass/tree/while_node.rb +0 -18
  126. data/lib/sass/util/multibyte_string_scanner.rb +0 -155
  127. data/lib/sass/util/subset_map.rb +0 -109
  128. data/lib/sass/util/test.rb +0 -10
  129. data/lib/sass/util.rb +0 -948
  130. data/lib/sass/version.rb +0 -126
  131. data/lib/sass.rb +0 -95
  132. data/rails/init.rb +0 -1
  133. data/test/Gemfile +0 -3
  134. data/test/Gemfile.lock +0 -10
  135. data/test/sass/cache_test.rb +0 -89
  136. data/test/sass/callbacks_test.rb +0 -61
  137. data/test/sass/conversion_test.rb +0 -1760
  138. data/test/sass/css2sass_test.rb +0 -458
  139. data/test/sass/data/hsl-rgb.txt +0 -319
  140. data/test/sass/engine_test.rb +0 -3244
  141. data/test/sass/exec_test.rb +0 -86
  142. data/test/sass/extend_test.rb +0 -1482
  143. data/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
  144. data/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
  145. data/test/sass/functions_test.rb +0 -1139
  146. data/test/sass/importer_test.rb +0 -192
  147. data/test/sass/logger_test.rb +0 -58
  148. data/test/sass/mock_importer.rb +0 -49
  149. data/test/sass/more_results/more1.css +0 -9
  150. data/test/sass/more_results/more1_with_line_comments.css +0 -26
  151. data/test/sass/more_results/more_import.css +0 -29
  152. data/test/sass/more_templates/_more_partial.sass +0 -2
  153. data/test/sass/more_templates/more1.sass +0 -23
  154. data/test/sass/more_templates/more_import.sass +0 -11
  155. data/test/sass/plugin_test.rb +0 -564
  156. data/test/sass/results/alt.css +0 -4
  157. data/test/sass/results/basic.css +0 -9
  158. data/test/sass/results/cached_import_option.css +0 -3
  159. data/test/sass/results/compact.css +0 -5
  160. data/test/sass/results/complex.css +0 -86
  161. data/test/sass/results/compressed.css +0 -1
  162. data/test/sass/results/expanded.css +0 -19
  163. data/test/sass/results/filename_fn.css +0 -3
  164. data/test/sass/results/if.css +0 -3
  165. data/test/sass/results/import.css +0 -31
  166. data/test/sass/results/import_charset.css +0 -5
  167. data/test/sass/results/import_charset_1_8.css +0 -5
  168. data/test/sass/results/import_charset_ibm866.css +0 -5
  169. data/test/sass/results/import_content.css +0 -1
  170. data/test/sass/results/line_numbers.css +0 -49
  171. data/test/sass/results/mixins.css +0 -95
  172. data/test/sass/results/multiline.css +0 -24
  173. data/test/sass/results/nested.css +0 -22
  174. data/test/sass/results/options.css +0 -1
  175. data/test/sass/results/parent_ref.css +0 -13
  176. data/test/sass/results/script.css +0 -16
  177. data/test/sass/results/scss_import.css +0 -31
  178. data/test/sass/results/scss_importee.css +0 -2
  179. data/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
  180. data/test/sass/results/subdir/subdir.css +0 -3
  181. data/test/sass/results/units.css +0 -11
  182. data/test/sass/results/warn_imported.css +0 -0
  183. data/test/sass/script_conversion_test.rb +0 -299
  184. data/test/sass/script_test.rb +0 -622
  185. data/test/sass/scss/css_test.rb +0 -1100
  186. data/test/sass/scss/rx_test.rb +0 -156
  187. data/test/sass/scss/scss_test.rb +0 -2106
  188. data/test/sass/scss/test_helper.rb +0 -37
  189. data/test/sass/templates/_cached_import_option_partial.scss +0 -1
  190. data/test/sass/templates/_double_import_loop2.sass +0 -1
  191. data/test/sass/templates/_filename_fn_import.scss +0 -11
  192. data/test/sass/templates/_imported_charset_ibm866.sass +0 -4
  193. data/test/sass/templates/_imported_charset_utf8.sass +0 -4
  194. data/test/sass/templates/_imported_content.sass +0 -3
  195. data/test/sass/templates/_partial.sass +0 -2
  196. data/test/sass/templates/_same_name_different_partiality.scss +0 -1
  197. data/test/sass/templates/alt.sass +0 -16
  198. data/test/sass/templates/basic.sass +0 -23
  199. data/test/sass/templates/bork1.sass +0 -2
  200. data/test/sass/templates/bork2.sass +0 -2
  201. data/test/sass/templates/bork3.sass +0 -2
  202. data/test/sass/templates/bork4.sass +0 -2
  203. data/test/sass/templates/bork5.sass +0 -3
  204. data/test/sass/templates/cached_import_option.scss +0 -3
  205. data/test/sass/templates/compact.sass +0 -17
  206. data/test/sass/templates/complex.sass +0 -305
  207. data/test/sass/templates/compressed.sass +0 -15
  208. data/test/sass/templates/double_import_loop1.sass +0 -1
  209. data/test/sass/templates/expanded.sass +0 -17
  210. data/test/sass/templates/filename_fn.scss +0 -18
  211. data/test/sass/templates/if.sass +0 -11
  212. data/test/sass/templates/import.sass +0 -12
  213. data/test/sass/templates/import_charset.sass +0 -9
  214. data/test/sass/templates/import_charset_1_8.sass +0 -6
  215. data/test/sass/templates/import_charset_ibm866.sass +0 -11
  216. data/test/sass/templates/import_content.sass +0 -4
  217. data/test/sass/templates/importee.less +0 -2
  218. data/test/sass/templates/importee.sass +0 -19
  219. data/test/sass/templates/line_numbers.sass +0 -13
  220. data/test/sass/templates/mixin_bork.sass +0 -5
  221. data/test/sass/templates/mixins.sass +0 -76
  222. data/test/sass/templates/multiline.sass +0 -20
  223. data/test/sass/templates/nested.sass +0 -25
  224. data/test/sass/templates/nested_bork1.sass +0 -2
  225. data/test/sass/templates/nested_bork2.sass +0 -2
  226. data/test/sass/templates/nested_bork3.sass +0 -2
  227. data/test/sass/templates/nested_bork4.sass +0 -2
  228. data/test/sass/templates/nested_import.sass +0 -2
  229. data/test/sass/templates/nested_mixin_bork.sass +0 -6
  230. data/test/sass/templates/options.sass +0 -2
  231. data/test/sass/templates/parent_ref.sass +0 -25
  232. data/test/sass/templates/same_name_different_ext.sass +0 -2
  233. data/test/sass/templates/same_name_different_ext.scss +0 -1
  234. data/test/sass/templates/same_name_different_partiality.scss +0 -1
  235. data/test/sass/templates/script.sass +0 -101
  236. data/test/sass/templates/scss_import.scss +0 -11
  237. data/test/sass/templates/scss_importee.scss +0 -1
  238. data/test/sass/templates/single_import_loop.sass +0 -1
  239. data/test/sass/templates/subdir/import_up1.scss +0 -1
  240. data/test/sass/templates/subdir/import_up2.scss +0 -1
  241. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
  242. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
  243. data/test/sass/templates/subdir/subdir.sass +0 -6
  244. data/test/sass/templates/units.sass +0 -11
  245. data/test/sass/templates/warn.sass +0 -3
  246. data/test/sass/templates/warn_imported.sass +0 -4
  247. data/test/sass/test_helper.rb +0 -8
  248. data/test/sass/util/multibyte_string_scanner_test.rb +0 -147
  249. data/test/sass/util/subset_map_test.rb +0 -91
  250. data/test/sass/util_test.rb +0 -382
  251. data/test/test_helper.rb +0 -80
  252. /data/{test/sass/results/warn.css → template/files/.gitkeep} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8f62893deffb14c5336993042570b50eb1c89f9
4
- data.tar.gz: 6b545559331994315eb64a82c16e1e1ad53246f7
3
+ metadata.gz: b3674f0947497b99eaaebcb7ebc6f3899fe1c065
4
+ data.tar.gz: 90e1efc6b22306b3d7fc3866968b0749a6b1be2b
5
5
  SHA512:
6
- metadata.gz: 2513d08eebcf256df6f291175cdeb2f0b4f268c6fe36bf0e9dfadf26c08f59af0891c2892bcdd45a42be8f2076acc278c0c66258d6f384195099b0ced6324eba
7
- data.tar.gz: cee4bd797b3357aa4720171203f113b3b76966f839797b49e75a24eca482fc96ae2d0fb10922f8f983ab1818c2bfe5e0f1db7aafb0ba614df64a2f7853be9492
6
+ metadata.gz: 1dfb3c9eece994fc669314087cf8977bdceebf877a9f62946a414f7a8b56fdbeccc21f7d64c5ead5aa1672d37dcfaac84e9fcb4c7cc213526cc94613b7ccd00b
7
+ data.tar.gz: cbd50cc643080c1c13a9e2e1ff0bf077c25315d453d74e1a27936a3045843fffda3688b5c795b895589385c4a4de315298105850add4957174073bd771798ec8
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ /*.gem
2
+ /tmp
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activesupport'
4
+ gem 'csspool'
5
+ gem 'sass'
6
+
7
+ group :test do
8
+ gem 'rspec'
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (4.1.5)
5
+ i18n (~> 0.6, >= 0.6.9)
6
+ json (~> 1.7, >= 1.7.7)
7
+ minitest (~> 5.1)
8
+ thread_safe (~> 0.1)
9
+ tzinfo (~> 1.1)
10
+ csspool (4.0.0)
11
+ diff-lcs (1.2.5)
12
+ i18n (0.6.11)
13
+ json (1.8.1)
14
+ minitest (5.4.0)
15
+ rspec (3.0.0)
16
+ rspec-core (~> 3.0.0)
17
+ rspec-expectations (~> 3.0.0)
18
+ rspec-mocks (~> 3.0.0)
19
+ rspec-core (3.0.4)
20
+ rspec-support (~> 3.0.0)
21
+ rspec-expectations (3.0.4)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.0.0)
24
+ rspec-mocks (3.0.4)
25
+ rspec-support (~> 3.0.0)
26
+ rspec-support (3.0.4)
27
+ sass (3.4.0)
28
+ thread_safe (0.3.4)
29
+ tzinfo (1.2.2)
30
+ thread_safe (~> 0.1)
31
+
32
+ PLATFORMS
33
+ ruby
34
+
35
+ DEPENDENCIES
36
+ activesupport
37
+ csspool
38
+ rspec
39
+ sass
data/README.md CHANGED
@@ -1,201 +1,139 @@
1
- # Sass [![Gem Version](https://badge.fury.io/rb/sass.png)](http://badge.fury.io/rb/sass)
1
+ ##DESCRIPTION
2
2
 
3
- **Sass makes CSS fun again**. Sass is an extension of CSS3,
4
- adding nested rules, variables, mixins, selector inheritance, and more.
5
- It's translated to well-formatted, standard CSS
6
- using the command line tool or a web-framework plugin.
7
-
8
- Sass has two syntaxes. The new main syntax (as of Sass 3)
9
- is known as "SCSS" (for "Sassy CSS"),
10
- and is a superset of CSS3's syntax.
11
- This means that every valid CSS3 stylesheet is valid SCSS as well.
12
- SCSS files use the extension `.scss`.
13
-
14
- The second, older syntax is known as the indented syntax (or just "Sass").
15
- Inspired by Haml's terseness, it's intended for people
16
- who prefer conciseness over similarity to CSS.
17
- Instead of brackets and semicolons,
18
- it uses the indentation of lines to specify blocks.
19
- Although no longer the primary syntax,
20
- the indented syntax will continue to be supported.
21
- Files in the indented syntax use the extension `.sass`.
3
+ Xass extend Rails with namespacing Sass classes
22
4
 
23
- ## Using
24
-
25
- Sass can be used from the command line
26
- or as part of a web framework.
27
- The first step is to install the gem:
28
-
29
- gem install sass
5
+ ##INSTALLATION
30
6
 
31
- After you convert some CSS to Sass, you can run
32
-
33
- sass style.scss
34
-
35
- to compile it back to CSS.
36
- For more information on these commands, check out
37
-
38
- sass --help
39
-
40
- To install Sass in Rails 2,
41
- just add `config.gem "sass"` to `config/environment.rb`.
42
- In Rails 3, add `gem "sass"` to your Gemfile instead.
43
- `.sass` or `.scss` files should be placed in `public/stylesheets/sass`,
44
- where they'll be automatically compiled
45
- to corresponding CSS files in `public/stylesheets` when needed
46
- (the Sass template directory is customizable...
47
- see [the Sass reference](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#template_location-option) for details).
48
-
49
- Sass can also be used with any Rack-enabled web framework.
50
- To do so, just add
51
-
52
- require 'sass/plugin/rack'
53
- use Sass::Plugin::Rack
54
-
55
- to `config.ru`.
56
- Then any Sass files in `public/stylesheets/sass`
57
- will be compiled into CSS files in `public/stylesheets` on every request.
58
-
59
- To use Sass programmatically,
60
- check out the [YARD documentation](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#using_sass).
61
-
62
- ## Formatting
7
+ We suppose you use Rails with sass-rails.
63
8
 
64
- Sass is an extension of CSS
65
- that adds power and elegance to the basic language.
66
- It allows you to use [variables][vars], [nested rules][nested],
67
- [mixins][mixins], [inline imports][imports],
68
- and more, all with a fully CSS-compatible syntax.
69
- Sass helps keep large stylesheets well-organized,
70
- and get small stylesheets up and running quickly,
71
- particularly with the help of
72
- [the Compass style library](http://compass-style.org).
9
+ ###Gemfile
73
10
 
74
- [vars]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#variables_
75
- [nested]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#nested_rules
76
- [mixins]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#mixins
77
- [imports]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#import
11
+ ```rb
12
+ gem 'xass'
13
+ ```
78
14
 
79
- Sass has two syntaxes.
80
- The one presented here, known as "SCSS" (for "Sassy CSS"),
81
- is fully CSS-compatible.
82
- The other (older) syntax, known as the indented syntax or just "Sass",
83
- is whitespace-sensitive and indentation-based.
84
- For more information, see the [reference documentation][syntax].
85
-
86
- [syntax]: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax
87
-
88
- To run the following examples and see the CSS they produce,
89
- put them in a file called `test.scss` and run `sass test.scss`.
90
-
91
- ### Nesting
92
-
93
- Sass avoids repetition by nesting selectors within one another.
94
- The same thing works for properties.
95
-
96
- table.hl {
97
- margin: 2em 0;
98
- td.ln { text-align: right; }
99
- }
100
-
101
- li {
102
- font: {
103
- family: serif;
104
- weight: bold;
105
- size: 1.2em;
106
- }
107
- }
108
-
109
- ### Variables
110
-
111
- Use the same color all over the place?
112
- Need to do some math with height and width and text size?
113
- Sass supports variables, math operations, and many useful functions.
114
-
115
- $blue: #3bbfce;
116
- $margin: 16px;
117
-
118
- .content_navigation {
119
- border-color: $blue;
120
- color: darken($blue, 10%);
121
- }
15
+ ##USAGE
122
16
 
123
- .border {
124
- padding: $margin / 2;
125
- margin: $margin / 2;
126
- border-color: $blue;
127
- }
17
+ ###Example 1
128
18
 
129
- ### Mixins
130
-
131
- Even more powerful than variables,
132
- mixins allow you to re-use whole chunks of CSS,
133
- properties or selectors.
134
- You can even give them arguments.
135
-
136
- @mixin table-scaffolding {
137
- th {
138
- text-align: center;
139
- font-weight: bold;
140
- }
141
- td, th { padding: 2px; }
142
- }
143
-
144
- @mixin left($dist) {
145
- float: left;
146
- margin-left: $dist;
147
- }
148
-
149
- #data {
150
- @include left(10px);
151
- @include table-scaffolding;
152
- }
153
-
154
- A comprehensive list of features is available
155
- in the [Sass reference](http://sass-lang.com/documentation/file.SASS_REFERENCE.html).
156
-
157
- ## Executables
158
-
159
- The Sass gem includes several executables that are useful
160
- for dealing with Sass from the command line.
161
-
162
- ### `sass`
163
-
164
- The `sass` executable transforms a source Sass file into CSS.
165
- See `sass --help` for further information and options.
166
-
167
- ### `sass-convert`
168
-
169
- The `sass-convert` executable converts between CSS, Sass, and SCSS.
170
- When converting from CSS to Sass or SCSS,
171
- nesting is applied where appropriate.
172
- See `sass-convert --help` for further information and options.
173
-
174
- ## Authors
175
-
176
- Sass was envisioned by [Hampton Catlin](http://www.hamptoncatlin.com)
177
- (@hcatlin). However, Hampton doesn't even know his way around the code anymore
178
- and now occasionally consults on the language issues. Hampton lives in San
179
- Francisco, California and works as VP of Technology
180
- at [Moovweb](http://www.moovweb.com/).
181
-
182
- [Nathan Weizenbaum](http://nex-3.com) is the primary developer and architect of
183
- Sass. His hard work has kept the project alive by endlessly answering forum
184
- posts, fixing bugs, refactoring, finding speed improvements, writing
185
- documentation, implementing new features, and getting Hampton coffee (a fitting
186
- task for a boy-genius). Nathan lives in Seattle, Washington and works on
187
- [Dart](http://dartlang.org) application libraries at Google.
188
-
189
- [Chris Eppstein](http://acts-as-architect.blogspot.com) is a core contributor to
190
- Sass and the creator of Compass, the first Sass-based framework. Chris focuses
191
- on making Sass more powerful, easy to use, and on ways to speed its adoption
192
- through the web development community. Chris lives in San Jose, California with
193
- his wife and daughter. He is the Software Architect for
194
- [Caring.com](http://caring.com), a website devoted to the 34 Million caregivers
195
- whose parents are sick or elderly, that uses Haml and Sass.
196
-
197
- If you use this software, you must pay Hampton a compliment. And
198
- buy Nathan some jelly beans. Maybe pet a kitten. Yeah. Pet that kitty.
199
-
200
- Beyond that, the implementation is licensed under the MIT License.
201
- Okay, fine, I guess that means compliments aren't __required__.
19
+ ```sass
20
+ // /app/assets/stylesheets/application.sass
21
+
22
+ @import ./main/**/*
23
+ ```
24
+
25
+ ```sass
26
+ // /app/assets/stylesheets/main/hoge/piyo/fuga.sass
27
+
28
+ .hogehoge
29
+ width: 100px
30
+ ```
31
+
32
+ This emits the following css.
33
+
34
+ ```css
35
+ .hoge__piyo__fuga___hogehoge {
36
+ width: 100px;
37
+ }
38
+ ```
39
+
40
+ And,
41
+
42
+ ```haml
43
+ -# /app/views/someview.html.haml
44
+
45
+ = namespace :hoge, :piyo, :fuga do
46
+ %div{ class: ns(:hogehoge) }
47
+ ```
48
+
49
+ Then, you can apply `width: 100px` to the `div` element.
50
+
51
+ ###Example 2
52
+
53
+ You can use `root` class for convenience.
54
+
55
+ ```sass
56
+ // /app/assets/stylesheets/application.sass
57
+
58
+ @import ./main/**/*
59
+ ```
60
+
61
+ ```sass
62
+ // /app/assets/stylesheets/main/hoge/piyo/fuga.sass
63
+
64
+ .root
65
+ width: 10px
66
+
67
+ .hogehoge
68
+ width: 100px
69
+ ```
70
+
71
+ This emits the following css.
72
+
73
+ ```css
74
+ .hoge__piyo__fuga {
75
+ width: 10px;
76
+ }
77
+
78
+ .hoge__piyo__fuga___hogehoge {
79
+ width: 100px;
80
+ }
81
+ ```
82
+
83
+ And,
84
+
85
+ ```haml
86
+ -# /app/views/someview.html.haml
87
+
88
+ = namespace :hoge, :piyo, :fuga do
89
+ %div{ class: ns_root }
90
+ %div{ class: ns(:hogehoge) }
91
+ ```
92
+
93
+ You can also write as follows abbreviately.
94
+
95
+ ```haml
96
+ -# /app/views/someview.html.haml
97
+
98
+ = namespace_with_root :hoge, :piyo, :fuga do
99
+ %div{ class: ns(:hogehoge) }
100
+ ```
101
+
102
+ ###Example 3
103
+
104
+ You can use `_` prefix for unnamespaced .
105
+
106
+ ```sass
107
+ // /app/assets/stylesheets/application.sass
108
+
109
+ @import ./main/**/*
110
+ ```
111
+
112
+ ```sass
113
+ // /app/assets/stylesheets/main/hoge/piyo/fuga.sass
114
+
115
+ .root
116
+ width: 10px
117
+
118
+ .hogehoge
119
+ width: 100px
120
+
121
+ ._current
122
+ background-color: black
123
+ ```
124
+
125
+ This emits the following css.
126
+
127
+ ```css
128
+ .hoge__piyo__fuga {
129
+ width: 10px;
130
+ }
131
+
132
+ .hoge__piyo__fuga___hogehoge {
133
+ width: 100px;
134
+ }
135
+
136
+ .current {
137
+ background-color: black;
138
+ }
139
+ ```
data/lib/initialize.rb ADDED
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'active_support/all'
5
+ require 'csspool'
6
+ require 'sass'
7
+
8
+ ActiveSupport::Dependencies.autoload_paths << File.expand_path('../../lib', __FILE__)
data/lib/xass.rb ADDED
@@ -0,0 +1,67 @@
1
+ require_relative 'initialize'
2
+
3
+ module Sass
4
+ module Tree
5
+ class RootNode
6
+ alias :old_render :render
7
+
8
+ def render
9
+ old_render.split('/*').map { |x|
10
+ next x unless x.match(/^ line [0-9]+, /)
11
+ a, b = x.split("\n", 2)
12
+ m = a.match(/\/app\/assets\/stylesheets\/([^. ]+)\./)
13
+ next "#{a}\n#{b}" unless m
14
+ selector = class_replaced_selector(b.split("\n")[0].strip[0...-1].strip, class_prefix(m[1]))
15
+ "#{a}\n#{selector} {\n#{b.split("\n", 2)[1]}"
16
+ }.join('/*')
17
+ end
18
+
19
+ private
20
+
21
+ def class_replaced_selector(selector, class_prefix)
22
+ doc = CSSPool.CSS("#{selector} {}")
23
+ replace_class(doc, class_prefix)
24
+ doc_to_selector(doc)
25
+ end
26
+
27
+ def class_prefix(name)
28
+ names = name.split('/')
29
+ names = names[1..(names.index { |x| x.start_with?('!') } || -1)]
30
+ names.join('__')
31
+ end
32
+
33
+ def replace_class(doc, class_prefix)
34
+ doc.rule_sets[0].selectors.map do |selector|
35
+ selector.simple_selectors.each do |simple_selector|
36
+ simple_selector.additional_selectors.each do |additional_selector|
37
+ case additional_selector
38
+ when CSSPool::Selectors::Class
39
+ additional_selector.name = extended_selector(class_prefix, additional_selector.name)
40
+ when CSSPool::Selectors::PseudoClass
41
+ next unless additional_selector.extra
42
+ extra = class_replaced_selector(additional_selector.extra, class_prefix) rescue nil
43
+ additional_selector.extra = extra if extra
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ def doc_to_selector(doc)
51
+ doc.to_css.split("\n")[0][0...-1].strip.gsub(/\\[0-9]{6}/) do |c|
52
+ [c[1..-1].tr('0', '').to_i(16)].pack('U')
53
+ end
54
+ end
55
+
56
+ def extended_selector(class_prefix, klass)
57
+ if klass == 'root'
58
+ class_prefix
59
+ elsif klass.start_with?('_')
60
+ klass[1..-1]
61
+ else
62
+ "#{class_prefix}___#{klass}"
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
data/spec/secrets.yml ADDED
@@ -0,0 +1,4 @@
1
+ values:
2
+ test_key: test_value
3
+ files:
4
+ test_file_key: test_file_value
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ require 'secros'
5
+
6
+ def root_path
7
+ File.expand_path('../..', __FILE__)
8
+ end
data/spec/test_spec.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'test' do
4
+ it 'should succeed'
5
+ end
@@ -0,0 +1,2 @@
1
+ values:
2
+ files:
data/xass.gemspec ADDED
@@ -0,0 +1,15 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'xass'
3
+ s.version = '0.1.1'
4
+ s.authors = ['Tetsuri Moriya']
5
+ s.email = ['tetsuri.moriya@gmail.com']
6
+ s.summary = 'Sass namespace extension'
7
+ s.description = 'Namespace in sass'
8
+ s.homepage = 'https://github.com/pandora2000/xass'
9
+ s.license = 'MIT'
10
+ s.files = `git ls-files`.split("\n")
11
+ s.add_development_dependency 'rspec', '~> 0'
12
+ s.add_runtime_dependency 'activesupport', '~> 4.0'
13
+ s.add_runtime_dependency 'sass', '~> 0'
14
+ s.add_runtime_dependency 'csspool', '~> 0'
15
+ end