sassy-maps 0.3.2 → 0.4.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: 8ce9e65eba8234ecc2b838fe86c862f767912825
4
- data.tar.gz: 022e2d453f1dbaafe0645b3f1bc3b53d617d7bcd
3
+ metadata.gz: a09115491f465ef31bdbdaf51958e73c1811e44d
4
+ data.tar.gz: f0fccd177b07e76cacfb062303fc89226a609205
5
5
  SHA512:
6
- metadata.gz: b7ab3cbabcfec2ef7504668e8948f9355b302d4ced2b65831200ee68ecec6f7ad8e661709b1ec551d131a3071b9a3e0e849e46e099843c0c6c39175cbaaee413
7
- data.tar.gz: 0f76c8eaf043c90f1de57d5df18c8f08fda244d2c571d3839693efb15d5d6836ac3a46685413ee675121299acad936da075ec06049f62075ca0239bcff9ca388
6
+ metadata.gz: cd9ba6823061386181e086974dcee7b2ab5c6207a40dae43bf6187a9ae421b8c3a6e97753166eb8be6e9572aced6341bd7d1b091d82061456c47bcee11d042e1
7
+ data.tar.gz: 0e050fceb37f48c761f949b98ba7f8f1fc79840d676d999bef792399fbdb41402b4b385fc042bfbdc360ea8d0640897a905e0c5ffa9967529c535c31df5366fa
@@ -0,0 +1,100 @@
1
+ # Sassy Maps [![Gem Version](https://badge.fury.io/rb/sassy-maps.png)](http://badge.fury.io/rb/sassy-maps) [![Build Status](https://travis-ci.org/Team-Sass/Sassy-Maps.png?branch=0.x.x)](https://travis-ci.org/Team-Sass/Sassy-Maps)
2
+ Sassy Maps adds a variety of functions aimed at helping you work with Sass 3.3 maps much easier.
3
+
4
+ ## Table of Contents
5
+
6
+ 1. [Requirements](#requirements)
7
+ 2. [Installation](#installation)
8
+ 3. [Using Sassy Maps](#using-sassy-maps)
9
+ 4. [Functions](#functions)
10
+ 5. [Optional Modules](#optional-modules)
11
+ * [Memo](#memo)
12
+
13
+ ## Requirements
14
+
15
+ Sassy Maps is a Sass extension, so you're going to need Sass installed. If you do not already have Sass installed, please read [Install Sass](http://sass-lang.com/install). Sassy Maps 0.3.x requires *Sass 3.3.0* or higher.
16
+
17
+ **It is HIGHLY RECOMMENDED that you run all Sass (or Compass if using it) commands through [Bundler](http://bundler.io/)**
18
+
19
+ If the compiler you are using is not compatible with the above minimum versions, it will not compile correctly.
20
+
21
+ **BE AWARE that CodeKit and most other GUI compilers *do not support Bundler* and are therefore NOT RECOMMENDED**
22
+
23
+ ## Installation
24
+
25
+ The preferred way to install and use Sassy Maps is through Bundler. To do so, add the following to your Gemfile (Sass provided to ensure the correct versions are used):
26
+
27
+ ```ruby
28
+ gem "sass", "~>3.3.0"
29
+ gem "sassy-maps", "~>0.3.2"
30
+ ```
31
+
32
+ Once you have done so, run `bundle install` to install your dependencies, and remember to run all of your compilation through `bundle exec`.
33
+
34
+ You can also install Sassy Maps through [Bower](http://bower.io/) as it has no Ruby requirements. To do so, run the following command:
35
+
36
+ ```bash
37
+ bower install sassy-maps --save-dev
38
+ ```
39
+
40
+ *BE AWARE* that while you can install Sassy Maps through Bower, Sassy Maps still only works with Sass compilers that have full compatibility with Sass 3.3.x and greater. If using Compass, you are also going to need to add the folder using Compass's [`add_import_path`](http://compass-style.org/help/tutorials/configuration-reference/) config option instead of the standard `require`.
41
+
42
+ ## Using Sassy Maps
43
+
44
+ If you already have a project made and you'd like to use Sassy Maps with it, add the following to your `config.rb` file:
45
+
46
+ `require 'sassy-maps'`
47
+
48
+ Then, add the following to your Sass file towards the top:
49
+
50
+ `@import "sassy-maps";`
51
+
52
+ ## Functions
53
+
54
+ * `map-get-deep($map, $keys...)` - Returns the value of the final item in `$keys` from the map `$map`. Will return `null` if no value is present and will warn of errors in search (such as if an intermediate depth is `null` or not a `map`).
55
+ * `map-set($map, $key, $value)` - Returns a map that has the `$key` in `$map` set to the to given `$value`.
56
+ * `map-set-deep($map, $keys, $value)` - Returns a map that has the `$key` in `$map` set to the given `$value`. `$key` should be single-depth list of keys, for instance `map-set-deep($map, ('foo' 'bar' 'baz'), "Hello World")`.
57
+ * `map-to-string($map)` - Returns a string representation of the given `$map`.
58
+
59
+
60
+ ## Optional Modules
61
+
62
+ Sassy Maps comes with optional modules that extend upon the base functionality of Sassy Maps to provide additional map-based functionality. The following are optional modules available with Sassy Maps:
63
+
64
+ * [Memo](#memo)
65
+
66
+ ### Memo
67
+
68
+ Memo is a [Memoization](http://en.wikipedia.org/wiki/Memoization) framework for Sass. Designed with framework developers in mind, it makes it easy to store and retrieve the output of functions quickly and easily without needing to run the function again. For complex functions this should greatly speed up overall compilation time for repeat function calls with identical input.
69
+
70
+ To use Memo, simply include `@import "memo";` and you're good to go (normal [Sassy Maps installation](#installation) still applies). Memo comes with two functions:
71
+
72
+ * `memo-set($module, $key, $value)` - Sets a memoization `$key` to the given `$value` for the prescribed `$module` (framework). The function will return `true`. Also available as a mixin (`@include memo-set($module, $key, $value)`).
73
+ * `memo-get($module, $key)` - Returns the value of the memoization `$key` for the prescribed `$module`.
74
+
75
+ Using Memo is fairly simple, just check to see if there is a memoization value for your key (and it's not `null`); if there is, return that, if not, run through the function, set the memoization, and return that result. The following example stores whether Memo is available in a variable and uses the function name as the memoization module, but if building a framework such as [Breakpoint](http://github.com/team-sass/breakpoint), that framework should be the name of the memoization module.
76
+
77
+ ```scss
78
+ $Memo-Exists: function-exists(memo-get) and function-exists(memo-set);
79
+
80
+ @function percentage($target, $context) {
81
+ @if $Memo-Exists {
82
+ $result: memo-get(percentage, $target $context);
83
+
84
+ @if $result != null {
85
+ @return $result;
86
+ }
87
+ }
88
+
89
+ $result: $target / $context * 100%;
90
+
91
+ @if $Memo-Exists {
92
+ $holder: memo-set(percentage, $target $context, $result);
93
+ }
94
+
95
+ @return $result;
96
+ }
97
+
98
+ $half: percentage(20px, 40px); // No memoization exists, will run through the function
99
+ $half-again: percentage(20px, 40px); // Memoization exists, will just return that result
100
+ ```
@@ -1,33 +1,16 @@
1
- # All gems that are required for this extension to work should go here.
2
- # These are the requires you would normally put in your config.rb file
3
- # By default, you should always included Compass. Do not include your
4
- # extension.
1
+ require 'sassy-maps/version'
5
2
  require 'sass'
6
- require 'compass'
7
3
 
8
- # This tells Compass what your Compass extension is called, and where to find
9
- # its files
10
- # Replace 'styleguide' with the name of your style guide. Spaces allowed.
11
- base_directory = File.join(File.dirname(__FILE__), '..')
12
- stylesheets_dir = File.join(base_directory, 'stylesheets')
13
- templates_dir = File.join(base_directory, 'templates')
14
- Compass::Frameworks.register('sassy-maps', :stylesheets_directory => stylesheets_dir, :templates_directory => templates_dir)
4
+ sassy_maps_path = File.expand_path('../../sass', __FILE__)
15
5
 
16
- # Version and date of version for your Compass extension.
17
- # Replace Extemsopm with the name of your style guide
18
- # Letters, numbers, and underscores only
19
- # Version is a number. If a version contains alphas, it will be created as
20
- # a prerelease version
21
- # Date is in the form of YYYY-MM-DD
22
- module SassyMaps
23
- VERSION = "0.3.2"
24
- DATE = "2014-03-04"
6
+ if (defined? Compass)
7
+ Compass::Frameworks.register(
8
+ 'sassy-maps',
9
+ :stylesheets_directory => sassy_maps_path
10
+ )
11
+ else
12
+ ENV["SASS_PATH"] = [ENV["SASS_PATH"], sassy_maps_path].compact.join(File::PATH_SEPARATOR)
25
13
  end
26
14
 
27
- # This is where any custom SassScript should be placed. The functions will be
28
- # available on require of your extension without the need for users to import
29
- # any partials. Uncomment below.
30
-
31
- # module Sass::Script::Functions
32
- #
33
- # end
15
+ module SassyMaps
16
+ end
@@ -0,0 +1,4 @@
1
+ module SassyMaps
2
+ VERSION = "0.4.0"
3
+ DATE = "2014-06-03"
4
+ end
@@ -0,0 +1,16 @@
1
+ require 'tapout'
2
+ require 'tapout/reporters'
3
+
4
+ module Tapout
5
+ module Reporters
6
+ class NavigatorReporter < RuntimeReporter
7
+
8
+ def backtrace_snippets(test)
9
+ ''
10
+ end
11
+
12
+ end
13
+ end
14
+ end
15
+
16
+ Tapout::Reporters.index['navigator'] = Tapout::Reporters::NavigatorReporter
File without changes
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassy-maps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Richard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-04 00:00:00.000000000 Z
11
+ date: 2014-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -16,28 +16,112 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 3.3.0.rc.2
19
+ version: '3.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 3.3.0.rc.2
26
+ version: '3.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: compass
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.0.alpha.13
34
- type: :runtime
33
+ version: '0'
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitap
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tapout
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: term-ansicolor
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
39
102
  - !ruby/object:Gem::Version
40
- version: 1.0.0.alpha.13
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: colorize
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
41
125
  description: Map helper functions for Sass 3.3 Maps including get-deep and set/set-deep
42
126
  email:
43
127
  - sam@snug.ug
@@ -45,13 +129,15 @@ executables: []
45
129
  extensions: []
46
130
  extra_rdoc_files: []
47
131
  files:
132
+ - README.md
133
+ - lib/sassy-maps/version.rb
48
134
  - lib/sassy-maps.rb
49
- - stylesheets/_memo.scss
50
- - stylesheets/_sassy-maps.scss
51
- - stylesheets/sassy-maps/_map-get.scss
52
- - stylesheets/sassy-maps/_map-set.scss
53
- - stylesheets/sassy-maps/_map-to-string.scss
54
- - templates/project/Gemfile.txt
135
+ - lib/tapout/reporters/navigator_reporter.rb
136
+ - sass/_memo.scss
137
+ - sass/_sassy-maps.scss
138
+ - sass/sassy-maps/_map-get.scss
139
+ - sass/sassy-maps/_map-set.scss
140
+ - sass/sassy-maps/_map-to-string.scss
55
141
  homepage: https://github.com/Snugug/Sassy-Maps
56
142
  licenses:
57
143
  - MIT
@@ -69,10 +155,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
155
  requirements:
70
156
  - - '>='
71
157
  - !ruby/object:Gem::Version
72
- version: 1.3.6
158
+ version: '0'
73
159
  requirements: []
74
160
  rubyforge_project: sassy-maps
75
- rubygems_version: 2.0.3
161
+ rubygems_version: 2.0.14
76
162
  signing_key:
77
163
  specification_version: 4
78
164
  summary: Map helper functions for Sass 3.3 Maps
@@ -1,13 +0,0 @@
1
- # Pull gems from RubyGems
2
- source 'https://rubygems.org'
3
-
4
- gem 'sass', "~> 3.3.0.rc.6"
5
- gem 'compass', "~> 1.0.0.alpha.18"
6
-
7
- group :test do
8
- gem 'rake'
9
- gem "diffy", "~> 3.0.1"
10
- gem "colorize", "~> 0.6.0"
11
- end
12
-
13
- gem 'Sassy Maps', '~>0.3.2'