flint-gs 1.3.6 → 1.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: 6d634d2596ab6f3aa67f9fe262a32561c71fdd01
4
- data.tar.gz: e37a7f913e9446345993ffdfda2af406110d1c25
3
+ metadata.gz: 4fe5b9e2c39e010d685a44b3e5aa5d3b55b04322
4
+ data.tar.gz: 4bf01de85d73743b890317fd08246dc57149cd4e
5
5
  SHA512:
6
- metadata.gz: 2f78b6604a1f92b16fdce75fd8330ade50b6e2b5cc82cd70080b929ce6fc3b7aa512f7fbb257091ba135009263d5bcf2b346947f5f0fe69f4255ab0e6383c0ab
7
- data.tar.gz: f27df87a21beea5e8cae0fb27d23928b43fb9448790d2c243b78980ea3feaaf00dd235a8566bed329c60efd548cce65cf305ae0812e404f0dd338140091ea40f
6
+ metadata.gz: 38fc91877f9c8a18fbaf4f487fee66412d26df390f6566e5b61ac82d98aa38cf1c4f611e11965b60bb5742d892097124c29865a09785d4ef42094d5501f6f003
7
+ data.tar.gz: f06b0d3af65caac112d92ae5210f4016f89157b5195939baac98126a47ab7d9198bb66565acff026f0a74d9a8f0c7afb0cca49fa9e995c960ce30cff479b9184
data/README.md CHANGED
@@ -9,7 +9,7 @@ Enjoy.
9
9
  ##Requirements
10
10
 
11
11
  * Sass ~> 3.3.0
12
- * Compass ~> 0.12.1
12
+ * Compass ~> 1.0.0.alpha.19
13
13
 
14
14
  ##Installation
15
15
 
@@ -23,45 +23,53 @@ If you don't want to install the gem (?!), download/clone the current build file
23
23
 
24
24
  ###Config
25
25
 
26
- Flint's `config map` is unique in the ability that you may define an unlimited number of breakpoints for your project. Whether that be 2 breakpoints, or even 12 breakpoints. Flint gives you full control over the column count on each breakpoint, and unlike most frameworks, you may name these anything that you like. Flint is smart and will figure out which one you're talking about.
26
+ Flint's `config` map is unique in the ability that you may define an unlimited number of breakpoints for your project. Whether that be 2 breakpoints, or even 12 breakpoints. Flint gives you full control over the column count on each breakpoint, and unlike most frameworks, you may name these anything that you like. Flint is smart and will figure out which one you're talking about.
27
27
 
28
28
  Speaking of not being like most frameworks, Flint does not require you to set a ridiculous amount of variables just to use a single breakpoint. It actually doesn't require you to set *any* variables. It also doesn't require you to install a seperate extension so that you can define your breakpoints; *all of these features are baked into Flint.* Your columns are fully related to your breakpoints, so that there is never any confusion and everything is kept nice and simple.
29
29
 
30
- To begin, you can either use the default config (below) which comes baked in, or you can define your own using the `$flint` variable, using the default config as a template.
30
+ ####Usage
31
31
 
32
- Settings may be entered in `px` or `em`, and Flint will do the rest.
32
+ To begin, you can either use the default `config` (below) which comes baked in, or you can define your own using the `$flint` variable, using the default config as a template. Settings may be entered in `px` or `em`, and Flint will do the rest.
33
33
 
34
- *Keep in mind, whatever unit you choose to use here needs to be used consistently throughout Flint.*
35
-
36
- No mixing of `px` and `em` units. Also, Flint does require that you follow a `DESC` order for your breakpoint configuration, this way it can traverse the config map correctly to output valid media queries.
34
+ *Keep in mind, whatever unit you choose to use here needs to be used consistently throughout Flint. No mixing of `px` and `em` units. Also, Flint does require that you follow a `DESC` order for your breakpoint configuration, this way it can traverse the config map correctly to output valid media queries.*
37
35
 
38
36
  ```scss
39
37
  // Configuration map
40
38
  //--------------------------------------------------------------------------------
41
39
  // @param [map] : Here you can set up your various breakpoints for your
42
40
  // project. Any number of breakpoints is acceptable. You must include a column
43
- // count and breakpoint value for each listed breakpoint. Order does not have
44
- // to follow `ASC` or `DESC`. Unit chosen here must be used consistently
41
+ // count and breakpoint value for each listed breakpoint. The order does have
42
+ // to follow a `DESC` order. Unit (px | em) chosen here must be used consistently
45
43
  // throughout the rest of the config map.
46
44
  //--------------------------------------------------------------------------------
47
45
  // @param default [string] : alias of breakpoint that is your grid default
48
46
  // @param grid [string] : style of grid
49
- // @param gutter [integer | false] : contextual size of gutter
50
- // @param float-style [integer | false] : float direction
51
- // @param max-width [integer | bool] : max-width for `containers`
47
+ // @param gutter [number | false] : contextual size of gutter
48
+ // @param float-style [number | false] : float direction
49
+ // @param max-width [number | bool] : max-width for containers
52
50
  // @param center-container [bool] : if you want a centered container
53
51
  // @param border-box-sizing [bool] : if you want box-sizing: border-box applied
54
52
  // @param debug-mode [bool] : ouputs debug properties
55
53
  // -------------------------------------------------------------------------------
56
54
 
57
55
  $flint: (
58
- // grid configuration
56
+
57
+ // Grid configuration
59
58
  "config": (
60
- // define breakpoints [any amount of breakpoints]
61
- "desktop": ( // [any alias you like, minus reserved flint words (i.e. "settings", etc.)]
62
- "columns": 16, // [0-infinity]
63
- "breakpoint": 1280px, // [0-infinity(unit)]
59
+
60
+ // Define breakpoints (any amount of breakpoints)
61
+ // Any alias you like, minus reserved Flint words (i.e. "settings", "config", etc.)
62
+ "desktop": (
63
+
64
+ // Options: 0-infinity
65
+ "columns": 16,
66
+
67
+ // Options: value(unit)
68
+ "breakpoint": 1280px,
64
69
  ),
70
+
71
+ // Same applies for other breakpoints
72
+ // Remember, you're not fixed to just 4 breakpoints like we have here
65
73
  "laptop": (
66
74
  "columns": 12,
67
75
  "breakpoint": 960px,
@@ -74,16 +82,33 @@ $flint: (
74
82
  "columns": 4,
75
83
  "breakpoint": 320px,
76
84
  ),
77
- // additional grid settings [required]
85
+
86
+ // Additional grid settings (required)
78
87
  "settings": (
79
- "default": "mobile", // [any breakpoint's alias]
80
- "grid": "fluid", // [fluid | fixed]
81
- "gutter": 10px, // [0-infinity(unit) | false]
82
- "float-style": "left", // [left | right]
83
- "max-width": true, // [true : uses highest breakpoint | false | value(unit)]
84
- "center-container": true, // [true | false]
85
- "border-box-sizing": true, // [true | false]
86
- "debug-mode": false, // [true | false ]
88
+
89
+ // Any breakpoint's alias
90
+ "default": "mobile",
91
+
92
+ // Options: fluid | fixed
93
+ "grid": "fluid",
94
+
95
+ // Options: value(unit)
96
+ "gutter": 10px,
97
+
98
+ // Options: left | right
99
+ "float-style": "left",
100
+
101
+ // Options: true (uses highest breakpoint) | false | value(unit)
102
+ "max-width": true,
103
+
104
+ // Options: true | false
105
+ "center-container": true,
106
+
107
+ // Options: true | false
108
+ "border-box-sizing": true,
109
+
110
+ // Options: true | false
111
+ "debug-mode": false,
87
112
  ),
88
113
  ),
89
114
  );
@@ -91,13 +116,13 @@ $flint: (
91
116
 
92
117
  ###Foundation
93
118
 
94
- If you selected `border-box-sizing: true`, then it is *advised* to create a global foundation instance like so,
119
+ If you selected `"border-box-sizing": true`, then it is *advised* to create a global foundation instance like so,
95
120
 
96
121
  ```scss
97
122
  @include _(foundation);
98
123
  ```
99
124
 
100
- That way your output won't be riddled with `"box-sizing"` declarations everytime you define a span. This will automatically output the rules onto the global selector `*`. In the future this might be automatic, but for now I'll keep it manual.
125
+ That way your output won't be riddled with `box-sizing` declarations everytime you define a span. This will automatically output the rules onto the global selector `*`. In the future this might be automatic, but for now I'll keep it manual.
101
126
 
102
127
  ###Container
103
128
 
@@ -270,8 +295,8 @@ Use this if your nested context is *identical* across all breakpoints. The `cont
270
295
  @include _(3, auto); // Equivalent to : _(3, 6)
271
296
  }
272
297
 
273
- // When using `auto`, Flint 'falls back' from the topmost selector until one is
274
- // found that has an instance, and it will calculate it's context based on that
298
+ // When using `auto`, Flint 'falls back' from the topmost selector until one is
299
+ // found that has an instance, and it will calculate it's context based on that
275
300
  // instances span for the current breakpoint.
276
301
  ```
277
302
 
@@ -677,7 +702,7 @@ Outputs,
677
702
 
678
703
  ###Shift
679
704
 
680
- Much like the gutter modifiers, you may also call in a shift parameter using the `$shift` variable. This will cause the element to shift the desired amount of columns using positive/negative left margins.
705
+ Much like the gutter modifiers, you may also call in a shift parameter using the `$shift` variable. This will cause the element to shift the desired amount of columns using positive/negative left margins.
681
706
 
682
707
  ```scss
683
708
  // shift 4 columns to the right across all breakpoints
@@ -785,7 +810,7 @@ Due to the way **BEM** is written, the instance functions cannot fallback to pre
785
810
  ```scss
786
811
  .block {
787
812
  @include _(4);
788
-
813
+
789
814
  &__element {
790
815
  @include _(2, auto);
791
816
  }
@@ -797,7 +822,7 @@ Will result in a` @warning`, and will not compile correctly as `.block` and `.bl
797
822
  ```scss
798
823
  .block {
799
824
  @include _(4);
800
-
825
+
801
826
  .block__element {
802
827
  @include _(2, auto);
803
828
  }
@@ -820,78 +845,17 @@ This will allow the instance functions to properly fallback from `.block .block_
820
845
  ```scss
821
846
  .block {
822
847
  @include _(4);
823
-
848
+
824
849
  &__element {
825
850
  @include _(2, 4);
826
851
  }
827
852
  }
828
853
  ```
829
854
 
830
- ##Change Log
831
-
832
- Going to start keeping a log of changes starting (4/11/14).**
833
-
834
- ####6/11/14
835
- * Cleaning house. Cleaned up function definitions and documentation, quoted all strings, and overall just made the code more tidy.
836
-
837
- ####5/20/14
838
- * Fixed issue with `(for x y z)` loop not outputting correct breakpoints due to an invalid if statement.
839
-
840
- ####5/19/14
841
- * Fixed issue with comma seperated parent selectors causing errors and other issues.
842
- * Added small clean up functions for comma seperated selector strings for various functions.
843
-
844
- ####5/16/14
845
- * Added `$context: auto` to for fixed grids. It will automatically get the parent instance's width, and calculate on that instead of the base breakpoint.
846
- * This fixes issues where parents couldn't contain children of the same span, and the further you would nest, the worse the issue would get.
847
-
848
- ####5/14/14
849
- * Fixed issue with `_(greater than y)` not outputting the correct calculations on `fixed` grids
850
- * Issue was that when you used for example: `_(greater than laptop)`, `laptop` would actually be included, instead of ommitted. It now acts as 'anything above laptops breakpoint', the same way `less than y` works.
851
- * Adjusted the way breakpoints are calculated for easier modifications moving forward.
852
- * Optimized `calc-breakpoint()` function
853
-
854
- ####5/09/14
855
- * Added ability to pass an abitrary `$context` while maintaining a consistent gutter
856
- * Small changes to `debug-mode`
857
- * Added parent instance selector to output
858
- * Added actual `$context` in place of `auto` in output
859
-
860
- ####5/02/14
861
- * Adjusted `$length` variable in `string-to-list()` for better performance.
862
- * Added 2 additional aliases for `$gutter` modifiers
863
- * `alpha > first`
864
- * `omega > last`
865
-
866
- ####4/30/14
867
- * Fixed issue with comma separated child selectors throwing an error. `Fixes #5`
868
-
869
- ####4/25/14
870
- * Added aliases for `$gutter` modifiers
871
- * `null > default | regular | normal`
872
- * `alpha > no-left`
873
- * `omega > no-right`
874
- * `row > none`
875
- * Removed option for `gutter: false` in config. Use `0(unit)` from now on.
876
-
877
- ####4/24/14
878
- * Added `$gutter: inside` modifier
879
- * Adjusted `$span: 0` to hide element instead of compiling with no width
880
- * Corrected small issue with `less than x`, `greater than x` on fixed grids
881
- * Cleaned up variable/function names
882
- * Added detailed comments to all mixins/functions
883
-
884
- ####4/18/14
885
- * Built `.gemspec` so that Flint can be installed via `gem install flint-gs`
886
- * Added `bower.json` so that Flint can be installed via Bower
887
- * Organized file structure by splitting functions/mixins into separate files for easier modifications/version control moving forward.
888
-
889
- ####4/12/14
890
- * You can now take advantage of both `$shift` and `$gutter` modifiers together.
891
-
892
- ####4/11/14
893
- * You can now use `$context: auto`, and we'll do all the calculations for you. Just be sure a container element actually exists or you'll get some weird output, or none at all. Pretty cool feature utilizing the new `instance` map, which keeps track of every `instance` of the `_()` mixin, and saves all the tasty variables for use-cases like this.
894
-
855
+ ## Authors
895
856
 
857
+ [Ezekiel Gabrielse](http://ezekielg.com)
896
858
 
859
+ ## License
897
860
 
861
+ Flint is available under the [MIT](http://opensource.org/licenses/MIT) license.
data/lib/flint.rb CHANGED
@@ -5,8 +5,8 @@ Compass::Frameworks.register('flint', :path => extension_path)
5
5
  # Version is a number. If a version contains alphas, it will be created as a prerelease version
6
6
  # Date is in the form of YYYY-MM-DD
7
7
  module Flint
8
- VERSION = "1.3.6"
9
- DATE = "2014-06-11"
8
+ VERSION = "1.4.0"
9
+ DATE = "2014-06-26"
10
10
  end
11
11
 
12
12
  # Custom functions
@@ -14,4 +14,4 @@ module Sass::Script::Functions
14
14
  def selector_string()
15
15
  return Sass::Script::String.new(environment.selector.to_s)
16
16
  end
17
- end
17
+ end
@@ -2,50 +2,78 @@
2
2
  //--------------------------------------------------------------------------------
3
3
  // @param [map] : Here you can set up your various breakpoints for your
4
4
  // project. Any number of breakpoints is acceptable. You must include a column
5
- // count and breakpoint value for each listed breakpoint. Order does not have
6
- // to follow `ASC` or `DESC`. Unit chosen here must be used consistently
5
+ // count and breakpoint value for each listed breakpoint. The order does have
6
+ // to follow a `DESC` order. Unit (px | em) chosen here must be used consistently
7
7
  // throughout the rest of the config map.
8
8
  //--------------------------------------------------------------------------------
9
9
  // @param default [string] : alias of breakpoint that is your grid default
10
10
  // @param grid [string] : style of grid
11
- // @param gutter [integer | false] : contextual size of gutter
12
- // @param float-style [integer | false] : float direction
13
- // @param max-width [integer | bool] : max-width for `containers`
11
+ // @param gutter [number | false] : contextual size of gutter
12
+ // @param float-style [number | false] : float direction
13
+ // @param max-width [number | bool] : max-width for containers
14
14
  // @param center-container [bool] : if you want a centered container
15
15
  // @param border-box-sizing [bool] : if you want box-sizing: border-box applied
16
16
  // @param debug-mode [bool] : ouputs debug properties
17
17
  // -------------------------------------------------------------------------------
18
18
 
19
19
  $flint: (
20
- // grid configuration
20
+
21
+ // Grid configuration
21
22
  "config": (
22
- // define breakpoints [any amount of breakpoints]
23
- "desktop": ( // [any alias you like, minus reserved flint words (i.e. "settings", etc.)]
24
- "columns": 16, // [0-infinity]
25
- "breakpoint": 1280px, // [0-infinity(unit)]
23
+
24
+ // Define breakpoints [any amount of breakpoints]
25
+ // Any alias you like, minus reserved Flint words [i.e. "settings", "config", etc.]
26
+ "desktop": (
27
+
28
+ // Options: 0-infinity
29
+ "columns": 16,
30
+
31
+ // Options: number[unit]
32
+ "breakpoint": 80em,
26
33
  ),
34
+
35
+ // Same applies for other breakpoints
36
+ // ----
37
+ // Remember, you're not fixed to just 4 breakpoints like we have here
27
38
  "laptop": (
28
39
  "columns": 12,
29
- "breakpoint": 960px,
40
+ "breakpoint": 60em,
30
41
  ),
31
42
  "tablet": (
32
43
  "columns": 8,
33
- "breakpoint": 640px,
44
+ "breakpoint": 40em,
34
45
  ),
35
46
  "mobile": (
36
47
  "columns": 4,
37
- "breakpoint": 320px,
48
+ "breakpoint": 20em,
38
49
  ),
39
- // additional grid settings [required]
50
+
51
+ // Additional grid settings [required]
40
52
  "settings": (
41
- "default": "mobile", // [any breakpoint's alias]
42
- "grid": "fluid", // [fluid | fixed]
43
- "gutter": 10px, // [0-infinity(unit) | false]
44
- "float-style": "left", // [left | right]
45
- "max-width": false, // [true : uses highest breakpoint | false | value(unit)]
46
- "center-container": true, // [true | false]
47
- "border-box-sizing": true, // [true | false]
48
- "debug-mode": false, // [true | false ]
53
+
54
+ // Any breakpoint's alias
55
+ "default": "mobile",
56
+
57
+ // Options: fluid | fixed
58
+ "grid": "fluid",
59
+
60
+ // Options: number[unit]
61
+ "gutter": 0.625em,
62
+
63
+ // Options: left | right
64
+ "float-style": "left",
65
+
66
+ // Options: true [uses highest breakpoint] | false | number[unit]
67
+ "max-width": true,
68
+
69
+ // Options: true | false
70
+ "center-container": true,
71
+
72
+ // Options: true | false
73
+ "border-box-sizing": true,
74
+
75
+ // Options: true | false
76
+ "debug-mode": false,
49
77
  ),
50
78
  ),
51
- ) !default;
79
+ ) !default;
@@ -30,7 +30,7 @@
30
30
 
31
31
  // Checks if item is number
32
32
  //--------------------------------------------------------------------------------
33
- // @param $n [integer] : value
33
+ // @param $n [number] : value
34
34
  // -------------------------------------------------------------------------------
35
35
  // @return [bool]
36
36
 
@@ -64,7 +64,7 @@
64
64
 
65
65
  @function get-all-keys() {
66
66
  $all-keys: ();
67
-
67
+
68
68
  @for $i from 1 through (length(map-fetch($flint, "config")) - 1) {
69
69
  $key: steal-key($i);
70
70
  $all-keys: append($all-keys, $key, "comma");
@@ -86,7 +86,7 @@
86
86
  $all-breakpoints: append($all-breakpoints, $value, "comma");
87
87
  }
88
88
  }
89
- }
89
+ }
90
90
 
91
91
  @return $all-breakpoints;
92
92
  }
@@ -155,4 +155,24 @@
155
155
  }
156
156
 
157
157
  @return $all-columns;
158
- }
158
+ }
159
+
160
+ // Returns the unit used in config
161
+ // -------------------------------------------------------------------------------
162
+ // @return [bool]
163
+
164
+ @function get-config-unit() {
165
+ @return unit(get-value("settings", "gutter"));
166
+ }
167
+
168
+ // Convert pixel value to em
169
+ // -------------------------------------------------------------------------------
170
+ // @param $target [num] : pixel value
171
+ // @param $context [num] : context to divide by
172
+ // -------------------------------------------------------------------------------
173
+ // @return : em value of $target relative to $context
174
+ // -------------------------------------------------------------------------------
175
+
176
+ @function em($target, $context: $flint__base-font-size) {
177
+ @return ($target / $context) * 1em;
178
+ }
@@ -8,7 +8,7 @@
8
8
  // -------------------------------------------------------------------------------
9
9
  // @param $n [string] : how to calculate breakpoint
10
10
  // @param $key [string] : key of breakpoint
11
- // @param $i [integer] : index of current breakpoint
11
+ // @param $i [number] : index of current breakpoint
12
12
  // -------------------------------------------------------------------------------
13
13
  // @return calculated value
14
14