base.sass 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5196ecc5e76b30bedc2a493397fb4cd871ca6d68
4
- data.tar.gz: 95d0e1bb92cd0a25682d61fb397336368e6d29d7
3
+ metadata.gz: 2f1d195e6a52cb50dbd31f9a401dfaf1e686d182
4
+ data.tar.gz: b4a174b36a7f61faa0d63b56a62193d85818562a
5
5
  SHA512:
6
- metadata.gz: 5018bd64cc72ef5ec0238edd5deca2e7aa7a0d2ebb5c4cf8d8af0b0ce5ba00e2e628a140b1738b03ef5f724bea42282827591e503bb4fae22590d03709df8d72
7
- data.tar.gz: 6a5fb1eee707df5b80c9eac2a7a2a48da5aa24a7ae7009bc3704c1f6fc3f086b880f33d5e326c9dd6904039ea458e6ad17cd41df1db6807166fa36399d0a7895
6
+ metadata.gz: 7d8f72b9bba990f74cae21bd9cb7821a06e0ca73b84d4a51df5eaefb75aa440e24fef112dd04b71948ad02e7034ffda687baeb64463a5e7c8bf1bb6c1ca6191a
7
+ data.tar.gz: 24832fd86a78a1175f60d57cab1a2b180256ddce534859ecf3fd332045754066e159417e8fc45758bbcca459195ca10ff1c93ff51b148b76d60866557e4a0afd
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.2.0
4
+
5
+ ### Upgrades `app-config()`
6
+
3
7
  ## v1.1.0
4
8
 
5
9
  ### Overrides official map functions to support nest keys
@@ -16,7 +20,7 @@
16
20
 
17
21
  ## v1.0.1
18
22
 
19
- - Fix font url in `font-face()` for ie9
23
+ ### Fix font url in `font-face()` for ie9
20
24
 
21
25
  ## v1.0.0
22
26
 
data/Readme.md CHANGED
@@ -10,7 +10,7 @@
10
10
  In your [`Gemfile`](http://bundler.io/v1.6/gemfile.html):
11
11
 
12
12
  ```ruby
13
- gem 'base.sass', '~> 1.1'
13
+ gem 'base.sass', '~> 1.2'
14
14
  ```
15
15
 
16
16
  Or in command line:
@@ -21,7 +21,7 @@ $ gem install base.sass
21
21
 
22
22
  ## Usage
23
23
 
24
- In your Sass file:
24
+ At top of your Sass file:
25
25
 
26
26
  ```scss
27
27
  @import 'base.sass/*';
@@ -30,7 +30,7 @@ In your Sass file:
30
30
  And then in command line:
31
31
 
32
32
  ```sh
33
- $ sass -r base.sass --watch src:dist
33
+ $ sass --watch -r base.sass src:dist
34
34
  ```
35
35
 
36
36
  Or in `config.rb`:
@@ -41,12 +41,12 @@ require 'base.sass'
41
41
 
42
42
  ## Features
43
43
 
44
- ### Read environment variable (case insensitive)
44
+ ### Read environment variables (case insensitive)
45
45
 
46
46
  When you run:
47
47
 
48
48
  ```sh
49
- $ SASS_ENV=production sass -r base.sass --update src:dist
49
+ $ SASS_ENV=production sass --update -r base.sass src:dist
50
50
  ```
51
51
 
52
52
  Then you can use `env()` in a Sass file to get the value:
@@ -1,6 +1,6 @@
1
1
  module Sass::Script::Functions
2
2
 
3
- # Returns the value for environment variable name as a string.
3
+ # Returns the value of environment variable associated with the given name.
4
4
  # Returns null if the named variable does not exist.
5
5
  #
6
6
  # Examples:
@@ -12,16 +12,31 @@ module Sass::Script::Functions
12
12
  ruby_to_sass(ENV[name.value.gsub('-', '_').upcase])
13
13
  end
14
14
 
15
- # Get the configurations of current app.
16
- # Returns null if the named configuration does not exist.
15
+ # Returns the config associated with the given name.
16
+ # Configs are be grouped by `SASS_ENV` environment.
17
17
  #
18
18
  # Examples:
19
- # $app-config: (timestamp: '1.0.0');
20
- # app-config(timestamp) => 1.0.0
19
+ # $app-config: (
20
+ # development: (
21
+ # foo: bar
22
+ # ),
23
+ # production: (
24
+ # foo: baz
25
+ # )
26
+ # );
27
+ #
28
+ # $ sass --watch -r base.sass src:dist
29
+ # app-config(foo) => bar
30
+ #
31
+ # $ SASS_ENV=production sass --watch -r base.sass src:dist
32
+ # app-config(foo) => baz
21
33
  def app_config(name)
22
34
  assert_type name, :String
35
+
23
36
  config = environment.global_env.var('app-config')
24
- config.is_a?(Sass::Script::Value::Map) && config.to_h[name] || null
37
+ return null unless config.is_a? Sass::Script::Value::Map
38
+
39
+ map_get(config, *[env(identifier('sass-env')), name])
25
40
  end
26
41
 
27
42
  end
@@ -96,7 +96,7 @@ module Sass::Script::Functions
96
96
 
97
97
  map2.each do |k, v|
98
98
  orig = map1[k]
99
- map1[k] = get_value(orig, v)
99
+ map1[k] = compare_value(orig, v)
100
100
  end
101
101
 
102
102
  map(map1)
@@ -113,7 +113,7 @@ module Sass::Script::Functions
113
113
  (keys.empty? ? map : map_get(map, *keys)).to_h.dup
114
114
  end
115
115
 
116
- def get_value(oldVal, newVal)
116
+ def compare_value(oldVal, newVal)
117
117
  if oldVal.is_a?(Sass::Script::Value::Map) && newVal.is_a?(Sass::Script::Value::Map)
118
118
  map_merge(oldVal, newVal, bool(true))
119
119
  elsif oldVal.is_a?(Sass::Script::Value::List) && newVal.is_a?(Sass::Script::Value::List)
@@ -1,12 +1,8 @@
1
- $app-config: () !default;
2
- $browser-supports: parse-rules('last 1 version') !default;
3
-
1
+ @import 'functions/support';
2
+ @import 'functions/list';
3
+ @import 'mixins/placeholder-wrapper';
4
4
  @import 'mixins/clearfix';
5
5
  @import 'mixins/ellipsis-overflow';
6
- @import 'mixins/float';
7
6
  @import 'mixins/font-face';
8
7
  @import 'mixins/inline-block';
9
- @import 'mixins/placeholder-wrapper';
10
-
11
- @import 'functions/list';
12
- @import 'functions/support';
8
+ @import 'mixins/float';
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: base.sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - junjun.zhang