archetype 0.0.1.pre.3.811928f → 0.0.1.pre.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +24 -1
  3. data/LICENSE +1 -1
  4. data/README.md +1 -1
  5. data/VERSION.yml +1 -1
  6. data/bin/archetype +3 -0
  7. data/lib/archetype.rb +4 -0
  8. data/lib/archetype/actions/help.rb +16 -0
  9. data/lib/archetype/actions/theme.rb +73 -0
  10. data/lib/archetype/executor.rb +27 -0
  11. data/lib/archetype/functions/hash.rb +28 -12
  12. data/lib/archetype/functions/helpers.rb +46 -13
  13. data/lib/archetype/functions/styleguide_memoizer.rb +9 -1
  14. data/lib/archetype/sass_extensions.rb +1 -0
  15. data/lib/archetype/sass_extensions/functions/lists.rb +34 -40
  16. data/lib/archetype/sass_extensions/functions/locale.rb +32 -16
  17. data/lib/archetype/sass_extensions/functions/styleguide.rb +115 -37
  18. data/lib/archetype/sass_extensions/functions/ui.rb +3 -2
  19. data/lib/archetype/sass_extensions/functions/version.rb +11 -6
  20. data/lib/archetype/sass_extensions/monkey_patches.rb +3 -0
  21. data/lib/archetype/sass_extensions/monkey_patches/handle_include_loop.rb +13 -0
  22. data/lib/archetype/version.rb +19 -12
  23. data/stylesheets/archetype/_base.scss +3 -0
  24. data/stylesheets/archetype/_config.scss +31 -7
  25. data/stylesheets/archetype/_hacks.scss +17 -5
  26. data/stylesheets/archetype/_ui.scss +64 -23
  27. data/stylesheets/archetype/styleguide/components/_buttons.scss +6 -6
  28. data/stylesheets/archetype/styleguide/components/_headlines.scss +1 -0
  29. data/stylesheets/archetype/styleguide/components/_links.scss +2 -0
  30. data/stylesheets/archetype/util/_styles.scss +59 -14
  31. data/stylesheets/archetype/util/_targeting.scss +1 -1
  32. data/templates/_theme/_components.scss +3 -0
  33. data/templates/_theme/_config.scss +1 -0
  34. data/templates/_theme/_core.scss +13 -0
  35. data/templates/_theme/_helpers.scss +1 -0
  36. data/templates/_theme/_primitives.scss +3 -0
  37. data/templates/_theme/components/README +1 -0
  38. data/templates/_theme/primitives/README +1 -0
  39. data/test/fixtures/stylesheets/archetype/config.rb +2 -0
  40. data/test/fixtures/stylesheets/archetype/expected/base.css +349 -0
  41. data/test/fixtures/stylesheets/archetype/expected/hacks/ie_pseudo.css +3 -3
  42. data/test/fixtures/stylesheets/archetype/expected/hacks/transparent_focusable.css +4 -0
  43. data/test/fixtures/stylesheets/archetype/expected/locale.css +23 -0
  44. data/test/fixtures/stylesheets/archetype/expected/styleguide/alerts.css +675 -0
  45. data/test/fixtures/stylesheets/archetype/expected/styleguide/buttons.css +110 -18
  46. data/test/fixtures/stylesheets/archetype/expected/styleguide/drop.css +63 -0
  47. data/test/fixtures/stylesheets/archetype/expected/styleguide/extend.css +7 -0
  48. data/test/fixtures/stylesheets/archetype/expected/styleguide/invalid_structures.css +21 -0
  49. data/test/fixtures/stylesheets/archetype/expected/styleguide/multi_value.css +13 -0
  50. data/test/fixtures/stylesheets/archetype/expected/styleguide/selective_state.css +3 -0
  51. data/test/fixtures/stylesheets/archetype/expected/ui/glyph_icon.css +116 -2
  52. data/test/fixtures/stylesheets/archetype/expected/utilities/associative.css +9 -0
  53. data/test/fixtures/stylesheets/archetype/expected/utilities/custom_output_styler.css +8 -0
  54. data/test/fixtures/stylesheets/archetype/expected/utilities/targeting/target-browser.css +5 -0
  55. data/test/fixtures/stylesheets/archetype/source/base.scss +3 -0
  56. data/test/fixtures/stylesheets/archetype/source/hacks/transparent_focusable.scss +5 -0
  57. data/test/fixtures/stylesheets/archetype/source/locale.scss +43 -0
  58. data/test/fixtures/stylesheets/archetype/source/styleguide/alerts.scss +21 -0
  59. data/test/fixtures/stylesheets/archetype/source/styleguide/buttons.scss +5 -1
  60. data/test/fixtures/stylesheets/archetype/source/styleguide/drop.scss +101 -0
  61. data/test/fixtures/stylesheets/archetype/source/styleguide/extend.scss +23 -0
  62. data/test/fixtures/stylesheets/archetype/source/styleguide/fallback_styles.scss +1 -1
  63. data/test/fixtures/stylesheets/archetype/source/styleguide/invalid_structures.scss +85 -0
  64. data/test/fixtures/stylesheets/archetype/source/styleguide/multi_value.scss +18 -0
  65. data/test/fixtures/stylesheets/archetype/source/styleguide/nested_styleguides.scss +1 -1
  66. data/test/fixtures/stylesheets/archetype/source/styleguide/selective_state.scss +1 -1
  67. data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +30 -0
  68. data/test/fixtures/stylesheets/archetype/source/utilities/associative.scss +24 -0
  69. data/test/fixtures/stylesheets/archetype/source/utilities/custom_output_styler.scss +21 -0
  70. data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +8 -1
  71. data/test/helpers/test_case.rb +2 -2
  72. data/test/integrations/archetype_test.rb +3 -1
  73. data/test/units/sass_extensions_test.rb +18 -25
  74. metadata +108 -36
  75. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders-s7889ccc8c1.png +0 -0
@@ -3,17 +3,36 @@
3
3
  #
4
4
  module Archetype::SassExtensions::Locale
5
5
  #
6
- # get the current locale specified in config
6
+ # get the current locale specified in config or test a list of locales against the current locale
7
7
  #
8
+ # *Parameters*:
9
+ # - <tt>$locales</tt> {List} the list of locales to test
8
10
  # *Returns*:
9
- # - {String} the current locale
11
+ # - {String|Boolean} the current locale or whether or not the current locale is in the test set
10
12
  #
11
- def locale
12
- return Sass::Script::String.new(Compass.configuration.locale || 'en_US')
13
+ def locale(locales = nil)
14
+ locale = (Compass.configuration.locale || 'en_US').to_s
15
+ # if the locales are nil, just return the current locale
16
+ return Sass::Script::String.new(locale) if locales.nil?
17
+ locales = locales.to_a.collect{|i| i.to_s}
18
+ # add wild card support for language or territory
19
+ match = locale.match(LOCALE_PATTERN)
20
+ # language with wildcard territory
21
+ language = match[1] + '_'
22
+ # territory with wildcard language
23
+ territory = '_' + match[2]
24
+ # for each item, look it up in the alias list
25
+ locales.each do |key|
26
+ if a = locale_aliases[key]
27
+ locales.delete(key)
28
+ locales.concat(a)
29
+ end
30
+ end
31
+ return Sass::Script::Bool.new(locales.include?(locale) || locales.include?(language) || locales.include?(territory))
13
32
  end
14
33
 
15
34
  #
16
- # test a list of locales against the current locale (supports an alias map)
35
+ # test a list of locales against the current locale (this is now just an alias for locales(), for back-compat)
17
36
  #
18
37
  # *Parameters*:
19
38
  # - <tt>$locales</tt> {List} the list of locales to test
@@ -21,16 +40,9 @@ module Archetype::SassExtensions::Locale
21
40
  # - {Boolean} is the current locale in the list or not
22
41
  #
23
42
  def lang(locales)
24
- locales = locales.to_a.collect{|i| i.to_s}
25
- locales.each do |key|
26
- if a = locale_aliases[key]
27
- locales.delete(key)
28
- locales.concat(a)
29
- end
30
- end
31
- return Sass::Script::Bool.new(locales.include?(locale.to_s))
43
+ return locale(locales)
32
44
  end
33
-
45
+
34
46
  #
35
47
  # get the current reading direction
36
48
  #
@@ -43,6 +55,9 @@ module Archetype::SassExtensions::Locale
43
55
  end
44
56
 
45
57
  private
58
+
59
+ LOCALE_PATTERN = /([a-z]{2})[-_]?([a-z]{2}?)/i
60
+
46
61
  #
47
62
  # provides an alias mapping for locale names
48
63
  #
@@ -52,8 +67,9 @@ private
52
67
  # TODO - make this easily extensible
53
68
  def locale_aliases
54
69
  if @locale_aliases.nil?
55
- a = {}
56
- a['CJK'] = ['ja_JP', 'ko_KR', 'zh_TW', 'zh_CN']
70
+ a = {
71
+ 'CJK' => ['ja_JP', 'ko_KR', 'zh_TW', 'zh_CN']
72
+ }
57
73
  @locale_aliases = a
58
74
  end
59
75
  return @locale_aliases
@@ -15,10 +15,13 @@ module Archetype::SassExtensions::Styleguide
15
15
  DEFAULT = 'default'
16
16
  REGEX = 'regex'
17
17
  SPECIAL = %w(states selectors)
18
+ DROPALL = %w(all true)
18
19
  # these are unique CSS keys that can be exploited to provide fallback functionality by providing a second value
19
20
  # e.g color: red; color: rgba(255,0,0, 0.8);
20
- FALLBACKS = %w(background background-image background-color border border-bottom border-bottom-color border-color border-left border-left-color border-right border-right-color border-top border-top-color clip color layer-background-color outline outline-color white-space)
21
- ADDITIVES = FALLBACKS + [DROP, INHERIT, STYLEGUIDE]
21
+ FALLBACKS = %w(background background-image background-color border border-bottom border-bottom-color border-color border-left border-left-color border-right border-right-color border-top border-top-color clip color layer-background-color outline outline-color white-space extend)
22
+ # these are mixins that make sense to run multiple times within a block
23
+ MULTIMIXINS = %w(target-browser)
24
+ ADDITIVES = FALLBACKS + [DROP, INHERIT, STYLEGUIDE] + MULTIMIXINS
22
25
  @@archetype_styleguide_mutex = Mutex.new
23
26
  # :startdoc:
24
27
 
@@ -76,7 +79,7 @@ module Archetype::SassExtensions::Styleguide
76
79
  extensions = theme[:extensions]
77
80
  return Sass::Script::Bool.new(false) if component_exists(id, theme, extension, force)
78
81
  extensions.push(extension)
79
- components[id] = (components[id] ||= {}).rmerge(helpers.list_to_hash(data, 1, SPECIAL, ADDITIVES))
82
+ components[id] = (components[id] ||= Archetype::Hash.new).rmerge(helpers.list_to_hash(data, 1, SPECIAL, ADDITIVES))
80
83
  return Sass::Script::Bool.new(true)
81
84
  end
82
85
  end
@@ -98,7 +101,7 @@ module Archetype::SassExtensions::Styleguide
98
101
  #
99
102
  def styleguide_component_exists(id, theme = nil, extension = nil, force = false)
100
103
  @@archetype_styleguide_mutex.synchronize do
101
- extension = helpers.to_str(extension) if not extension.nil?
104
+ extension = helpers.to_str(extension).hash if not extension.nil?
102
105
  return Sass::Script::Bool.new( component_exists(id, theme, extension, force) )
103
106
  end
104
107
  end
@@ -223,29 +226,34 @@ private
223
226
  #
224
227
  def extract_styles(id, modifiers, strict = false, theme = nil, context = nil)
225
228
  theme = get_theme(theme)
226
- context ||= theme[:components][id] || {}
229
+ context ||= theme[:components][id] || Archetype::Hash.new
227
230
  modifiers = helpers.to_str(modifiers)
228
- return {} if context.nil? or context.empty?
231
+ return Archetype::Hash.new if context.nil? or context.empty?
229
232
  # push on the defaults first
230
- out = (strict ? resolve_dependents(id, context[modifiers], theme[:name], context) : context[DEFAULT]) || {}
233
+ out = (strict ? resolve_dependents(id, context[modifiers], theme[:name], context) : context[DEFAULT]) || Archetype::Hash.new
231
234
  out = out.clone
232
235
  # if it's not strict, find anything that matched
233
236
  if not strict
234
237
  modifiers = modifiers.split
235
- context.each do |definition|
238
+ context.each do |key, definition|
239
+ definition = [key, definition]
236
240
  modifier = definition[0]
237
241
  if modifier != DEFAULT
238
242
  match = true
239
243
  modifier = modifier.split
240
244
  if modifier[0] == REGEX
241
245
  # if it's a regex pattern, test if it matches
242
- match = modifiers.join(' ') =~ /#{modifiers[1].gsub(/\A"|"\Z/, '')}/i
246
+ match = modifiers.join(' ') =~ /#{modifier[1].gsub(/\A"|"\Z/, '')}/i
243
247
  else
244
248
  # otherwise, if the modifier isn't in our list of modifiers, it's not valid and just move on
245
249
  modifier.each { |i| match = false if not modifiers.include?(i) }
246
250
  end
247
251
  # if it matched, process it
248
- out = out.rmerge(resolve_dependents(id, definition[1], theme[:name], nil, out.keys)) if match
252
+ if match
253
+ tmp = resolve_dependents(id, definition[1], theme[:name], nil, out)
254
+ out, tmp = post_resolve_drops(out, tmp)
255
+ out = out.rmerge(tmp)
256
+ end
249
257
  end
250
258
  end
251
259
  end
@@ -253,15 +261,19 @@ private
253
261
  # this lets us define special states and elements
254
262
  SPECIAL.each do |special_key|
255
263
  if out.is_a? Hash
256
- special = out[special_key]
257
- tmp = {}
258
- (special || {}).each { |key, value| tmp[key] = extract_styles(key, key, true, theme[:name], special) }
259
- out[special_key] = tmp if not tmp.empty?
264
+ special = out[special_key] || Archetype::Hash.new
265
+ if special == 'nil'
266
+ out[special_key] = Archetype::Hash.new
267
+ else
268
+ tmp = Archetype::Hash.new
269
+ special.each { |key, value| tmp[key] = extract_styles(key, key, true, theme[:name], special) }
270
+ out[special_key] = tmp if not tmp.empty?
271
+ end
260
272
  end
261
273
  end
262
274
  # check for nested styleguides
263
275
  styleguide = out[STYLEGUIDE]
264
- if styleguide and not styleguide.empty?
276
+ if not (styleguide.nil? or styleguide.empty?)
265
277
  styles = get_styles(styleguide, theme[:name])
266
278
  out.delete(STYLEGUIDE)
267
279
  out = styles.rmerge(out)
@@ -269,6 +281,87 @@ private
269
281
  return out
270
282
  end
271
283
 
284
+ #
285
+ # given two objects, resolve the chain of dropped styles
286
+ # this runs after having already resolved the dropped styles and merged
287
+ #
288
+ # *Parameters*:
289
+ # - <tt>obj</tt> {Hash} the source object
290
+ # - <tt>merger</tt> {Hash} the object to be merged in
291
+ # *Returns*:
292
+ # - {Array.<Hash>} the resulting `obj` and `merger` objects
293
+ #
294
+ def post_resolve_drops(obj, merger)
295
+ return [obj, merger] if obj.nil? or merger.nil?
296
+ drop = merger[DROP]
297
+ keys = obj.keys
298
+ if not drop.nil?
299
+ drop.to_a.each do |key|
300
+ key = helpers.to_str(key)
301
+ obj.delete(key) if not SPECIAL.include?(key)
302
+ end
303
+ merger.delete(DROP)
304
+ else
305
+ end
306
+ SPECIAL.each do |special|
307
+ if obj[special].is_a?(Hash) and merger[special].is_a?(Hash)
308
+ obj[special], merger[special] = post_resolve_drops(obj[special], merger[special])
309
+ end
310
+ end
311
+ return [obj, merger]
312
+ end
313
+
314
+ #
315
+ # given two objects, resolve the chain of dropped styles
316
+ #
317
+ # *Parameters*:
318
+ # - <tt>value</tt> {Hash} the source object
319
+ # - <tt>obj</tt> {Hash} the object to be merged in
320
+ # - <tt>is_special</tt> {Boolean} whether this is from a SPECIAL branch of a Hash
321
+ # *Returns*:
322
+ # - {Array.<Hash>} the resulting value
323
+ #
324
+ def resolve_drops(value, obj, is_special = false)
325
+ return value if not (value.is_a?(Hash) and obj.is_a?(Hash))
326
+ keys = obj.keys
327
+ drop = value[DROP]
328
+ if not drop.nil?
329
+ tmp = Archetype::Hash.new
330
+ if DROPALL.include?(helpers.to_str(drop))
331
+ if not keys.nil?
332
+ keys.each do |key|
333
+ if SPECIAL.include?(key)
334
+ if not (obj[key].nil? or obj[key].empty?)
335
+ tmp[key] = Archetype::Hash.new
336
+ tmp[key][DROP] = obj[key].keys
337
+ end
338
+ else
339
+ tmp[key] = 'nil'
340
+ end
341
+ end
342
+ end
343
+ else
344
+ drop.to_a.each do |key|
345
+ key = helpers.to_str(key)
346
+ if SPECIAL.include?(key)
347
+ if not (obj[key].nil? or obj[key].empty?)
348
+ tmp[key] = Archetype::Hash.new
349
+ tmp[key][DROP] = obj[key].keys
350
+ end
351
+ else
352
+ tmp[key] = 'nil'
353
+ end
354
+ end
355
+ end
356
+ value.delete(DROP) if not is_special
357
+ value = tmp.rmerge(value)
358
+ end
359
+ value.each do |key|
360
+ value[key] = resolve_drops(value[key], obj[key], key, SPECIAL.include?(key)) if not value[key].nil?
361
+ end
362
+ return value
363
+ end
364
+
272
365
  #
273
366
  # resolve any dependent references from the component
274
367
  #
@@ -281,33 +374,19 @@ private
281
374
  # *Returns*:
282
375
  # - {Hash} a hash of the resolved styles
283
376
  #
284
- def resolve_dependents(id, value, theme = nil, context = nil, keys = nil)
377
+ def resolve_dependents(id, value, theme = nil, context = nil, obj = nil)
285
378
  # we have to create a clone here as the passed in value is volatile and we're performing destructive changes
286
379
  value = value.clone
287
380
  # check that we're dealing with a hash
288
381
  if value.is_a?(Hash)
289
382
  # check for dropped styles
290
- drop = value[DROP]
291
- if not drop.nil?
292
- tmp = {}
293
- if %w(all true).include?(helpers.to_str(drop)) and not keys.nil? and not keys.empty?
294
- keys.each do |key|
295
- tmp[key] = 'nil'
296
- end
297
- else
298
- drop = drop.to_a
299
- drop.each do |key|
300
- tmp[helpers.to_str(key)] = 'nil'
301
- end
302
- end
303
- value.delete(DROP)
304
- value = tmp.rmerge(value)
305
- end
383
+ value = resolve_drops(value, obj)
384
+
306
385
  # check for inheritance
307
386
  inherit = value[INHERIT]
308
- if inherit and not inherit.empty?
387
+ if not (inherit.nil? or inherit.empty?)
309
388
  # create a temporary object and extract the nested styles
310
- tmp = {}
389
+ tmp = Archetype::Hash.new
311
390
  inherit.each { |related| tmp = tmp.rmerge(extract_styles(id, related, true, theme, context)) }
312
391
  # remove the inheritance key and update the styles
313
392
  value.delete(INHERIT)
@@ -348,9 +427,8 @@ private
348
427
  #
349
428
  def get_styles(description, theme = nil, state = 'false')
350
429
  state = helpers.to_str(state)
351
- description = description.to_a
352
- styles = {}
353
- description.each do |sentence|
430
+ styles = Archetype::Hash.new
431
+ description.to_a.each do |sentence|
354
432
  # get the grammar from the sentence
355
433
  id, modifiers, token = grammar(sentence, theme, state)
356
434
  if id
@@ -18,10 +18,11 @@ module Archetype::SassExtensions::UI
18
18
  # - {String} the unique string
19
19
  #
20
20
  def unique(prefix = '')
21
- prefix = helpers.to_str(prefix).gsub(/\A"|"\Z/, '')
21
+ prefix = helpers.to_str(prefix, ' ', :quotes)
22
22
  prefix = '.' if prefix == 'class'
23
23
  prefix = '#' if prefix == 'id'
24
- return Sass::Script::String.new("#{prefix}archetype-uid-#{uid}")
24
+ suffix = Compass.configuration.testing ? "RANDOM_UID" : "#{Time.now.to_i}-#{rand(36**8).to_s(36)}-#{uid}"
25
+ return Sass::Script::String.new("#{prefix}archetype-uid-#{suffix}")
25
26
  end
26
27
 
27
28
  #
@@ -8,7 +8,7 @@ require 'sass/version'
8
8
  #
9
9
  module Archetype::SassExtensions::Version
10
10
  # :stopdoc:
11
- COMPARATOR_PATTERN = /([neglt]+|[><=!]+)/
11
+ COMPARATOR_PATTERN = /(\s[neqglt]+\s|[><=!]+)/
12
12
  VERSION_PATTERN = /\d+(\.\d+)*(\.[x|\*])?/
13
13
  # :startdoc:
14
14
 
@@ -21,10 +21,15 @@ module Archetype::SassExtensions::Version
21
21
  # - {String|Boolean} if no test or test is just a lookup of a framework, it returns the version of that framework, otherwise it returns the result of the test
22
22
  #
23
23
  def archetype_version(test = nil)
24
- test = test.nil? ? 'archetype' : helpers.to_str(test).gsub(/\A"|"\Z/, '').downcase
25
- lib = Archetype::VERSION
26
- lib = Compass::VERSION if test.include?('compass')
27
- lib = Sass::VERSION if test.include?('sass')
24
+ test = test.nil? ? 'archetype' : helpers.to_str(test, ' ', :quotes).downcase
25
+ lib = ''
26
+ if test.include?('compass')
27
+ lib = Compass::VERSION
28
+ elsif test.include?('sass')
29
+ lib = Sass::VERSION
30
+ else
31
+ lib = Archetype::VERSION
32
+ end
28
33
  # strip off any non-official versioning (e.g. pre/alpha/rc)
29
34
  lib = lib.match(VERSION_PATTERN)[0]
30
35
  result = compare_version(lib, test.match(VERSION_PATTERN), test.match(COMPARATOR_PATTERN))
@@ -55,7 +60,7 @@ private
55
60
  # check for wild cards
56
61
  wild = version.index('x')
57
62
  # check the comparison
58
- comparator = (comparator || [])[0] || 'eq'
63
+ comparator = ((comparator || [])[0] || 'eq').strip
59
64
  eq = comparator =~ /(e|=)/
60
65
  lt = comparator =~ /(l|<)/
61
66
  gt = comparator =~ /(g|>)/
@@ -0,0 +1,3 @@
1
+ %w(handle_include_loop).each do |patch|
2
+ require "archetype/sass_extensions/monkey_patches/#{patch}"
3
+ end
@@ -0,0 +1,13 @@
1
+ # :stopdoc:
2
+ # monkey patch Sass to exclude special mixins from it's include loop logic
3
+ module Sass
4
+ module Tree
5
+ module Visitors
6
+ class Perform
7
+ def handle_include_loop!(node)
8
+ # do nothing
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -10,7 +10,7 @@ module Archetype
10
10
  # Method borrowed from Compass. All credit goes to Chris Eppstein and other contributors
11
11
  # https://github.com/chriseppstein/compass/blob/stable/lib/compass/version.rb
12
12
  # \(This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum\)
13
- #
13
+ #
14
14
  # *Returns*:
15
15
  # - {String} the version of Archetype
16
16
  #
@@ -29,18 +29,25 @@ module Archetype
29
29
 
30
30
  def read_version
31
31
  require 'yaml'
32
- @version = YAML::load(File.read(scope('VERSION.yml')))
33
- @version[:teeny] = @version[:patch]
34
- @version[:string] = "#{@version[:major]}.#{@version[:minor]}"
35
- @version[:string] << ".#{@version[:patch]}" if @version[:patch]
36
- @version[:string] << ".#{@version[:build]}" if @version[:build]
37
- @version[:string] << ".#{@version[:state]}" if @version[:state]
38
- @version[:string] << ".#{@version[:iteration]}" if @version[:iteration]
39
- if !ENV['OFFICIAL'] && r = revision
40
- @version[:string] << ".#{r[0..6]}"
41
- @version[:rev] = r
32
+ begin
33
+ @version = YAML.load(File.read(scope('VERSION.yml')))
34
+ @version[:teeny] = @version[:patch]
35
+ @version[:string] = "#{@version[:major]}.#{@version[:minor]}"
36
+ @version[:string] << ".#{@version[:patch]}" if @version[:patch]
37
+ @version[:string] << ".#{@version[:build]}" if @version[:build]
38
+ @version[:string] << ".#{@version[:state]}" if @version[:state]
39
+ @version[:string] << ".#{@version[:iteration]}" if @version[:iteration]
40
+ if !ENV['OFFICIAL'] && r = revision
41
+ @version[:string] << ".#{r[0..6]}"
42
+ @version[:rev] = r
43
+ end
44
+ return @version
45
+ rescue
46
+ # this is a hack, but I'm not fully understanding how to fix this correctly
47
+ # see issue #4
48
+ # if it failed, try again, for now
49
+ return read_version
42
50
  end
43
- @version
44
51
  end
45
52
 
46
53
  def revision
@@ -38,6 +38,9 @@ $RESET_INIT: false !default;
38
38
  // the font-face mixin will likely change in a future version, keep an eye on this
39
39
  // https://github.com/chriseppstein/compass/issues/867
40
40
  @include font-face($CONFIG_GLYPHS_NAME, $CONFIG_GLYPHS_FILES, $CONFIG_GLYPHS_EOT, $CONFIG_GLYPHS_WEIGHT, $CONFIG_GLYPHS_STYLE);
41
+ // output a second @font-face set with a versioned family name
42
+ // this will help avoid collisions when multi-app CSS is loaded on a single page
43
+ @include font-face('#{$CONFIG_GLYPHS_NAME}-#{$CONFIG_GLYPHS_VERSION}', $CONFIG_GLYPHS_FILES, $CONFIG_GLYPHS_EOT, $CONFIG_GLYPHS_WEIGHT, $CONFIG_GLYPHS_STYLE);
41
44
  }
42
45
 
43
46
  // auto invoke base reset
@@ -46,7 +46,7 @@ $CONFIG_Z_INDEX_BASE: 0 !default;
46
46
  $CONFIG_Z_LAYERS_OFFSET: 100 !default; // the offset between z-layers
47
47
  $CONFIG_Z_LAYERS: (default dialog navigation) !default; // the orders for the z-layers
48
48
 
49
- // compass
49
+ // compass
50
50
  $COMPASS_RTL_SUPPORT: false !default; // does your Compass version support RTL? set to true if Compass mixins support RTL
51
51
 
52
52
  // sprites
@@ -304,12 +304,12 @@ $CONFIG_BROWSER_WARN_ON_HACK: false !default;
304
304
  $CONFIG_BROWSER_VENDORS_HACK: (
305
305
  (webkit-all, safari webkit chrome),
306
306
  (gecko-all, firefox gecko mozilla),
307
- (opera-all, opera)
307
+ (opera-all, opera) // NOTE: this may stop working once Opera switches over to using WebKit/Blink
308
308
  ) !default;
309
309
 
310
310
  // os targeting
311
311
  $CONFIG_OS_VENDORS_CLASS: (
312
- (os-win, windows win winxp win7),
312
+ (os-win, windows win winxp win7 win8),
313
313
  (os-mac, apple mac osx),
314
314
  (os-linux, linux),
315
315
  (os-other, other misc unknown)
@@ -321,21 +321,38 @@ $CORE_SAFE_FONTS: (
321
321
  (sans-serif, (
322
322
  (default, (
323
323
  (default (sans-serif)),
324
- (ko_KR ('Malgun Gothic', default))
324
+ (ko_KR ('Malgun Gothic', default)),
325
+ (zh_TW (SimSun, default)),
326
+ (zh_CN (SimSun, default)),
327
+ (th_TH (Tahoma, default)),
328
+ (ar_AE (Tahoma, Arial, 'Times New Roman', default))
325
329
  )),
326
330
  (win, (
327
331
  (default (Arial, sans-serif)),
328
332
  (ja_JP (メイリオ, Meiryo, 'MS Pゴシック', 'MS PGothic', default)),
329
- (ko_KR nil)
333
+ (zh_TW (default, '微軟正黑體', 'Microsoft JhengHei', PMingLiu, '宋体', SimSun)),
334
+ (zh_CN (Arial, '华文细黑', 'STHeiti Light', '微软雅黑体', 'Microsoft Yahei', '新宋体', NSimSun, '宋体', SimSun)), // Heiti/Yahei not showing up in Chrome and FF in windows. Removal of sans-serif fixes it.
335
+ (th_TH nil),
336
+ (ko_KR nil),
337
+ (ar_AE nil)
330
338
  )),
331
339
  (mac, (
332
340
  (default (Helvetica, Arial, sans-serif)),
341
+ (zh_TW (default, '黑體-繁', 'Heiti TC', '儷黑Pro', 'LiHei Pro', PMingLiu, '宋体', SimSun)),
342
+ (zh_CN (default, '黑体-简', 'Heiti SC', '华文细黑', 'STHeiti Light', '华文黑体', STHeiti)),
333
343
  (ja_JP ('Hiragino Kaku Gothic Pro', 'ヒラギノ角ゴ Pro W3', 'MS Pゴシック', 'MS PGothic', default)),
334
- (ko_KR nil)
344
+ (th_TH nil),
345
+ (ko_KR nil),
346
+ (ar_AE nil)
335
347
  )),
336
348
  (linux, (
337
349
  (default (Helvetica, FreeSans, 'Liberation Sans', Helmet, Arial, sans-serif)),
338
- (CJK nil)
350
+ (zh_TW (default, PMingLiu, '宋体', SimSun)),
351
+ (zh_CN (default, '新宋体', NSimSun, '宋体', SimSun)),
352
+ (ja_JP nil),
353
+ (th_TH nil),
354
+ (ko_KR nil),
355
+ (ar_AE nil)
339
356
  ))
340
357
  )),
341
358
  (serif, (
@@ -351,6 +368,13 @@ $CORE_SAFE_FONTS: (
351
368
  nil
352
369
  )),
353
370
  nil
371
+ )),
372
+ (headline, (
373
+ (default, (
374
+ (default nil), // by default, dont style headlines differently
375
+ (ar_AE ('Droid Arabic Naskh')) // TODO: need to include the webfont
376
+ )),
377
+ nil
354
378
  ))
355
379
  ); // note that this declaration isn't a `default`, but rather is enforced everytime. this can be modified (via extending $CONFIG_SAFE_FONTS)
356
380
  $CONFIG_SAFE_FONTS: () !default;