archetype 0.0.1.pre.12 → 0.0.1.pre.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/archetype.rb +4 -0
- data/lib/archetype/actions/help.rb +16 -0
- data/lib/archetype/actions/theme.rb +73 -0
- data/lib/archetype/executor.rb +27 -0
- data/lib/archetype/functions/hash.rb +28 -12
- data/lib/archetype/functions/helpers.rb +46 -13
- data/lib/archetype/functions/styleguide_memoizer.rb +10 -2
- data/lib/archetype/sass_extensions/functions/lists.rb +36 -42
- data/lib/archetype/sass_extensions/functions/locale.rb +32 -16
- data/lib/archetype/sass_extensions/functions/styleguide.rb +127 -38
- data/lib/archetype/sass_extensions/functions/ui.rb +3 -2
- data/lib/archetype/sass_extensions/functions/version.rb +11 -6
- data/lib/archetype/sass_extensions/monkey_patches.rb +1 -1
- data/lib/archetype/version.rb +2 -2
- data/stylesheets/archetype/_base.scss +7 -2
- data/stylesheets/archetype/_config.scss +8 -1
- data/stylesheets/archetype/_hacks.scss +51 -17
- data/stylesheets/archetype/_ui.scss +16 -5
- data/stylesheets/archetype/base/_h5bp.scss +12 -12
- data/stylesheets/archetype/base/_normalize.scss +178 -139
- data/stylesheets/archetype/grid/_grid.scss +13 -13
- data/stylesheets/archetype/styleguide/components/_buttons.scss +1 -0
- data/stylesheets/archetype/util/_debug.scss +4 -4
- data/stylesheets/archetype/util/_lists.scss +1 -1
- data/stylesheets/archetype/util/_misc.scss +1 -1
- data/stylesheets/archetype/util/_rtl.scss +1 -1
- data/stylesheets/archetype/util/_spacing.scss +6 -6
- data/stylesheets/archetype/util/_styles.scss +21 -10
- data/stylesheets/archetype/util/_targeting.scss +1 -1
- data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders-s7889ccc8c1.png +0 -0
- data/test/fixtures/stylesheets/archetype/config.rb +2 -0
- data/test/fixtures/stylesheets/archetype/source/base.scss +3 -0
- data/test/fixtures/stylesheets/archetype/source/hacks/transparent_focusable.scss +5 -0
- data/test/fixtures/stylesheets/archetype/source/locale.scss +43 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/alerts.scss +21 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/buttons.scss +5 -1
- data/test/fixtures/stylesheets/archetype/source/styleguide/drop.scss +101 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/extend.scss +24 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/invalid_structures.scss +85 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/multi_value.scss +18 -0
- data/test/fixtures/stylesheets/archetype/source/styleguide/nested_styleguides.scss +1 -1
- data/test/fixtures/stylesheets/archetype/source/styleguide/selective_state.scss +1 -1
- data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +30 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/associative.scss +24 -0
- data/test/fixtures/stylesheets/archetype/source/utilities/custom_output_styler.scss +4 -3
- data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +8 -1
- data/test/fixtures/stylesheets/archetype/tmp/b.css +14 -0
- data/test/fixtures/stylesheets/archetype/tmp/base.css +349 -0
- data/test/fixtures/stylesheets/archetype/tmp/hacks/ie_pseudo.css +11 -0
- data/test/fixtures/stylesheets/archetype/tmp/hacks/transparent_focusable.css +4 -0
- data/test/fixtures/stylesheets/archetype/tmp/locale.css +23 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/alerts.css +711 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/buttons.css +2119 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/drop.css +63 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/extend.css +11 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/fallback_styles.css +10 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/invalid_structures.css +21 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/multi_value.css +13 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/nested_styleguides.css +28 -0
- data/test/fixtures/stylesheets/archetype/tmp/styleguide/selective_state.css +177 -0
- data/test/fixtures/stylesheets/archetype/tmp/ui/glyph_icon.css +127 -0
- data/test/fixtures/stylesheets/archetype/tmp/ui/hide_element.css +8 -0
- data/test/fixtures/stylesheets/archetype/tmp/ui/stroke.css +17 -0
- data/test/fixtures/stylesheets/archetype/tmp/ui/triangle.css +35 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/associative.css +9 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/custom_output_styler.css +8 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/if-set.css +9 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/spacing/horizontal-spacing.css +29 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/spacing/vertical-spacing.css +29 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/filter.css +11 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/font-family.css +16 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/z-index.css +15 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/targeting/target-browser.css +105 -0
- data/test/fixtures/stylesheets/archetype/tmp/utilities/targeting/target-os.css +55 -0
- data/test/helpers/test_case.rb +2 -2
- data/test/integrations/archetype_test.rb +3 -1
- data/test/units/sass_extensions_test.rb +18 -25
- metadata +81 -3
@@ -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
|
-
|
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 (
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
|
@@ -72,11 +75,11 @@ module Archetype::SassExtensions::Styleguide
|
|
72
75
|
# if force was set, we'll create a random token for the name
|
73
76
|
extension = rand(36**8).to_s(36) if force
|
74
77
|
# convert the extension into a hash (if we don't have an extension, compose one out of its data)
|
75
|
-
extension = helpers.to_str(extension || data)
|
78
|
+
extension = helpers.to_str(extension || data)
|
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] ||=
|
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
|
@@ -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
|
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(' ') =~ /#{
|
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
|
-
|
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
|
-
|
258
|
-
|
259
|
-
|
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
|
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,
|
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
|
-
|
291
|
-
|
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
|
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)
|
@@ -329,13 +408,24 @@ private
|
|
329
408
|
def get_theme(theme)
|
330
409
|
theme_name = helpers.to_str(theme || 'archetype')
|
331
410
|
@@styleguide_themes ||= {}
|
332
|
-
|
411
|
+
themes = @@styleguide_themes[theme_name] ||= {}
|
412
|
+
cleanup_old_themes!(themes, options[:css_filename]) if rand < 0.333 # cleanup 1/3 of the time.
|
413
|
+
theme = themes[options[:css_filename]] ||= {}
|
333
414
|
theme[:name] ||= theme_name
|
334
415
|
theme[:components] ||= {}
|
335
416
|
theme[:extensions] ||= []
|
336
417
|
return theme
|
337
418
|
end
|
338
419
|
|
420
|
+
def cleanup_old_themes!(themes, css_filename)
|
421
|
+
themes.keys.each do |key|
|
422
|
+
if key != css_filename
|
423
|
+
themes.delete(key)
|
424
|
+
end
|
425
|
+
end
|
426
|
+
nil
|
427
|
+
end
|
428
|
+
|
339
429
|
#
|
340
430
|
# driver method for converting a sentence into a list of styles
|
341
431
|
#
|
@@ -348,9 +438,8 @@ private
|
|
348
438
|
#
|
349
439
|
def get_styles(description, theme = nil, state = 'false')
|
350
440
|
state = helpers.to_str(state)
|
351
|
-
|
352
|
-
|
353
|
-
description.each do |sentence|
|
441
|
+
styles = Archetype::Hash.new
|
442
|
+
description.to_a.each do |sentence|
|
354
443
|
# get the grammar from the sentence
|
355
444
|
id, modifiers, token = grammar(sentence, theme, state)
|
356
445
|
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
|
21
|
+
prefix = helpers.to_str(prefix, ' ', :quotes)
|
22
22
|
prefix = '.' if prefix == 'class'
|
23
23
|
prefix = '#' if prefix == 'id'
|
24
|
-
|
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 = /([
|
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
|
25
|
-
lib =
|
26
|
-
|
27
|
-
|
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|>)/
|
data/lib/archetype/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Archetype
|
2
|
-
VERSION = '0.0.1.pre.
|
3
|
-
end
|
2
|
+
VERSION = '0.0.1.pre.13'
|
3
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
@import "base/normalize";
|
3
3
|
@import "base/reset";
|
4
4
|
@import "base/hybrid";
|
5
|
+
@import "base/h5bp";
|
5
6
|
|
6
7
|
// protect against multiple resets
|
7
8
|
$RESET_INIT: false !default;
|
@@ -11,8 +12,8 @@ $RESET_INIT: false !default;
|
|
11
12
|
// sets the base styles for the page (e.g. reset or normalize)
|
12
13
|
// @mixin base
|
13
14
|
// @param $exclude {List} the list of styles to exclude @see _normalize.scss and _reset.scss
|
14
|
-
// @param $method {String} reset method [reset|normalize|hybrid]
|
15
|
-
// @param $force {
|
15
|
+
// @param $method {String} reset method [reset|normalize|h5bp|hybrid]
|
16
|
+
// @param $force {Boolean} force reset to invoke; by default base() can only be invoked once, to re-invoke must pass in $force: true
|
16
17
|
@mixin base($exclude: $CONFIG_RESET_EXCLUDES, $method: $CONFIG_RESET_METHOD, $force: false) {
|
17
18
|
@if not $RESET_INIT or $force {
|
18
19
|
$RESET_INIT: true;
|
@@ -20,6 +21,10 @@ $RESET_INIT: false !default;
|
|
20
21
|
@if $method == normalize {
|
21
22
|
@include base-normalize($exclude: $exclude);
|
22
23
|
}
|
24
|
+
// html5 boiler plate
|
25
|
+
@else if $method == h5bp {
|
26
|
+
@include base-h5bp($exclude: $exclude);
|
27
|
+
}
|
23
28
|
// hyrbid reset (reset + some normalize)
|
24
29
|
@else if $method == hybrid {
|
25
30
|
@include base-hybrid($exclude: $exclude);
|
@@ -40,6 +40,7 @@ $CONTENT_PLACEHOLDER: '\0020' !default;
|
|
40
40
|
$CONFIG_DISABLED_CSS: () !default; // a list of CSS3 features to always disable when using output-style()
|
41
41
|
$CONFIG_GENERATED_TAG_PREFIX: x-archetype !default; // the prefix for the tag name to create when using ie-pseudo method
|
42
42
|
$CONFIG_GENERATED_TAG_CSS: false !default; // styles to apply to the generated tag when using ie-pseudo method (use this as a way to reset styles on these tags)
|
43
|
+
$CONFIG_GENERATED_TAG_INLINE: true !default; // if `true` insert the styles inline on the generated tag, otherwise insert the styles in a unique css rule
|
43
44
|
|
44
45
|
// z-layers
|
45
46
|
$CONFIG_Z_INDEX_BASE: 0 !default; // the default starting layer for z-index calculations
|
@@ -60,7 +61,7 @@ $CONFIG_KEYFRAME_LOADERS: archetype-loader !default;
|
|
60
61
|
$CONFIG_GLYPHS_NAME: FontAwesome !default; // name for the font-face
|
61
62
|
$CONFIG_GLYPHS_VERSION: '0.0.1' !default; // the glyph library version number
|
62
63
|
$CONFIG_GLYPHS_SVG_ID: $CONFIG_GLYPHS_NAME !default;
|
63
|
-
$CONFIG_GLYPHS_BASE_PATH: 'vendor/archetype/fontawesome-webfont' !default; // generic path to all
|
64
|
+
$CONFIG_GLYPHS_BASE_PATH: 'vendor/archetype/fontawesome-webfont' !default; // generic path to all glyph fonts (sans extensions)
|
64
65
|
$CONFIG_GLYPHS_EOT: '#{$CONFIG_GLYPHS_BASE_PATH}.eot' !default;
|
65
66
|
$CONFIG_GLYPHS_FILES: font-files('#{$CONFIG_GLYPHS_BASE_PATH}.woff', '#{$CONFIG_GLYPHS_BASE_PATH}.ttf', '#{$CONFIG_GLYPHS_BASE_PATH}.svg##{$CONFIG_GLYPHS_SVG_ID}') !default;
|
66
67
|
$CONFIG_GLYPHS_WEIGHT: normal !default; // font-weight for glyphs
|
@@ -380,3 +381,9 @@ $CORE_SAFE_FONTS: (
|
|
380
381
|
); // note that this declaration isn't a `default`, but rather is enforced everytime. this can be modified (via extending $CONFIG_SAFE_FONTS)
|
381
382
|
$CONFIG_SAFE_FONTS: () !default;
|
382
383
|
$CONFIG_SAFE_FONTS: associative-merge($CORE_SAFE_FONTS, $CONFIG_SAFE_FONTS);
|
384
|
+
|
385
|
+
$archetype-glyph-selector: false !default;
|
386
|
+
$archetype-pseudo-selector: false !default;
|
387
|
+
|
388
|
+
$CORE_GLYPH_SELECTOR_VAR: '$archetype-glyph-selector';
|
389
|
+
$CORE_GLYPH_SELECTOR_VAR: '$archetype-pseudo-selector';
|