flint-gs 2.3.6 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +99 -98
- data/lib/flint-gs.rb +8 -0
- data/lib/flint.rb +22 -16
- data/lib/flint/functions.rb +99 -99
- data/lib/flint/version.rb +3 -3
- data/stylesheets/_flint.scss +7 -7
- data/stylesheets/flint/config/_config.scss +56 -56
- data/stylesheets/flint/functions/_functions.scss +48 -48
- data/stylesheets/flint/functions/helpers/_helpers.scss +229 -229
- data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +47 -47
- data/stylesheets/flint/functions/lib/_calc-width.scss +70 -70
- data/stylesheets/flint/functions/lib/_fluid-width.scss +15 -15
- data/stylesheets/flint/functions/lib/_get-index.scss +21 -21
- data/stylesheets/flint/functions/lib/_get-instance-value.scss +15 -15
- data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
- data/stylesheets/flint/functions/lib/_has-family-instance.scss +84 -84
- data/stylesheets/flint/functions/lib/_html-encode.scss +14 -14
- data/stylesheets/flint/functions/lib/_instance.scss +48 -48
- data/stylesheets/flint/functions/lib/_last.scss +14 -14
- data/stylesheets/flint/functions/lib/_list-to-str.scss +38 -38
- data/stylesheets/flint/functions/lib/_map-fetch.scss +31 -31
- data/stylesheets/flint/functions/lib/_next-index.scss +14 -14
- data/stylesheets/flint/functions/lib/_purge.scss +24 -24
- data/stylesheets/flint/functions/lib/_remove.scss +18 -18
- data/stylesheets/flint/functions/lib/_replace.scss +30 -30
- data/stylesheets/flint/functions/lib/_steal-key.scss +32 -32
- data/stylesheets/flint/functions/lib/_steal-values.scss +15 -15
- data/stylesheets/flint/functions/lib/_str-replace.scss +39 -39
- data/stylesheets/flint/functions/lib/_str-to-list.scss +89 -89
- data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +37 -37
- data/stylesheets/flint/functions/lib/_support-syntax.scss +31 -31
- data/stylesheets/flint/functions/lib/_types-in-list.scss +76 -76
- data/stylesheets/flint/functions/lib/_use-syntax.scss +22 -22
- data/stylesheets/flint/globals/_globals.scss +122 -122
- data/stylesheets/flint/mixins/_mixins.scss +11 -11
- data/stylesheets/flint/mixins/lib/_box-sizing.scss +18 -18
- data/stylesheets/flint/mixins/lib/_calculate.scss +241 -241
- data/stylesheets/flint/mixins/lib/_clearfix.scss +29 -29
- data/stylesheets/flint/mixins/lib/_container.scss +45 -45
- data/stylesheets/flint/mixins/lib/_grid-overlay.scss +73 -73
- data/stylesheets/flint/mixins/lib/_main.scss +1057 -1057
- data/stylesheets/flint/mixins/lib/_new-instance.scss +28 -28
- data/stylesheets/flint/mixins/lib/_print-instance.scss +44 -44
- data/tests/config.rb +22 -34
- data/tests/input/functions/_functions.scss +47 -47
- data/tests/input/functions/helpers/_helpers.scss +437 -437
- data/tests/input/functions/lib/_calc-breakpoint.scss +62 -62
- data/tests/input/functions/lib/_calc-width.scss +195 -195
- data/tests/input/functions/lib/_fluid-width.scss +32 -32
- data/tests/input/functions/lib/_get-index.scss +31 -31
- data/tests/input/functions/lib/_get-instance-value.scss +72 -72
- data/tests/input/functions/lib/_get-value.scss +28 -28
- data/tests/input/functions/lib/_has-family-instance.scss +35 -35
- data/tests/input/functions/lib/_instance.scss +187 -187
- data/tests/input/functions/lib/_last.scss +18 -18
- data/tests/input/functions/lib/_list-to-str.scss +28 -28
- data/tests/input/functions/lib/_map-fetch.scss +34 -34
- data/tests/input/functions/lib/_next-index.scss +24 -24
- data/tests/input/functions/lib/_purge.scss +14 -14
- data/tests/input/functions/lib/_remove.scss +14 -14
- data/tests/input/functions/lib/_replace.scss +14 -14
- data/tests/input/functions/lib/_steal-key.scss +19 -19
- data/tests/input/functions/lib/_steal-values.scss +16 -16
- data/tests/input/functions/lib/_str-replace.scss +14 -14
- data/tests/input/functions/lib/_str-to-list.scss +28 -28
- data/tests/input/functions/lib/_support-syntax-bem.scss +14 -14
- data/tests/input/functions/lib/_support-syntax.scss +21 -21
- data/tests/input/functions/lib/_types-in-list.scss +50 -50
- data/tests/input/functions/lib/_use-syntax.scss +14 -14
- data/tests/input/output.scss +250 -250
- data/tests/output/output.css +3499 -3499
- data/tests/tests.html +110 -110
- metadata +12 -212
- data/tests/bootcamp/CHANGELOG.md +0 -70
- data/tests/bootcamp/CONTRIBUTING.md +0 -72
- data/tests/bootcamp/Gruntfile.coffee +0 -34
- data/tests/bootcamp/LICENSE.md +0 -7
- data/tests/bootcamp/README.md +0 -52
- data/tests/bootcamp/bower.json +0 -15
- data/tests/bootcamp/dist/_bootcamp.scss +0 -46
- data/tests/bootcamp/dist/bootcamp.coffee +0 -101
- data/tests/bootcamp/dist/core/functions/_actual.scss +0 -3
- data/tests/bootcamp/dist/core/functions/_error.scss +0 -29
- data/tests/bootcamp/dist/core/functions/_expect.scss +0 -6
- data/tests/bootcamp/dist/core/functions/_not-to.scss +0 -5
- data/tests/bootcamp/dist/core/functions/_should.scss +0 -6
- data/tests/bootcamp/dist/core/functions/_to.scss +0 -5
- data/tests/bootcamp/dist/core/mixins/_describe.scss +0 -31
- data/tests/bootcamp/dist/core/mixins/_it.scss +0 -31
- data/tests/bootcamp/dist/core/mixins/_runner.scss +0 -28
- data/tests/bootcamp/dist/core/mixins/_should.scss +0 -46
- data/tests/bootcamp/dist/core/mixins/_xdescribe.scss +0 -9
- data/tests/bootcamp/dist/core/mixins/_xit.scss +0 -9
- data/tests/bootcamp/dist/core/variables/_helpers.scss +0 -5
- data/tests/bootcamp/dist/core/variables/_settings.scss +0 -2
- data/tests/bootcamp/dist/core/variables/_should.scss +0 -6
- data/tests/bootcamp/dist/core/variables/_trackers.scss +0 -6
- data/tests/bootcamp/dist/lib/_sassyjson.scss +0 -1075
- data/tests/bootcamp/dist/matchers/_be.scss +0 -3
- data/tests/bootcamp/dist/matchers/_equal.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-empty.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-longer-than.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-shorter-than.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_contain.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_deep-contain.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_deep-equal.scss +0 -47
- data/tests/bootcamp/dist/matchers/lists/_have-length-of.scss +0 -3
- data/tests/bootcamp/dist/matchers/numbers/_be-close-to.scss +0 -12
- data/tests/bootcamp/dist/matchers/numbers/_be-greater-than.scss +0 -12
- data/tests/bootcamp/dist/matchers/numbers/_be-less-than.scss +0 -12
- data/tests/bootcamp/dist/matchers/types/_be-falsy.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_be-null.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_be-truthy.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_have-type-of.scss +0 -3
- data/tests/bootcamp/dist/utils/_contain.scss +0 -15
- data/tests/bootcamp/dist/utils/_equal.scss +0 -23
- data/tests/bootcamp/dist/utils/_list-join.scss +0 -35
- data/tests/bootcamp/dist/utils/_power.scss +0 -15
- data/tests/bootcamp/package.json +0 -63
- data/tests/bootcamp/tasks/bootcamp.coffee +0 -83
- data/tests/bootcamp/test/core/functions/_actual.scss +0 -10
- data/tests/bootcamp/test/core/functions/_expect.scss +0 -6
- data/tests/bootcamp/test/core/functions/_not-to.scss +0 -5
- data/tests/bootcamp/test/core/functions/_should.scss +0 -10
- data/tests/bootcamp/test/core/functions/_to.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_describe.scss +0 -11
- data/tests/bootcamp/test/core/mixins/_it.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_should.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_xdescribe.scss +0 -28
- data/tests/bootcamp/test/core/mixins/_xit.scss +0 -12
- data/tests/bootcamp/test/matchers/_be.scss +0 -90
- data/tests/bootcamp/test/matchers/_equal.scss +0 -33
- data/tests/bootcamp/test/matchers/lists/_be-empty.scss +0 -12
- data/tests/bootcamp/test/matchers/lists/_be-longer-than.scss +0 -29
- data/tests/bootcamp/test/matchers/lists/_be-shorter-than.scss +0 -29
- data/tests/bootcamp/test/matchers/lists/_contain.scss +0 -39
- data/tests/bootcamp/test/matchers/lists/_deep-contain.scss +0 -51
- data/tests/bootcamp/test/matchers/lists/_deep-equal.scss +0 -151
- data/tests/bootcamp/test/matchers/lists/_have-length-of.scss +0 -31
- data/tests/bootcamp/test/matchers/numbers/_be-close-to.scss +0 -24
- data/tests/bootcamp/test/matchers/numbers/_be-greater-than.scss +0 -16
- data/tests/bootcamp/test/matchers/numbers/_be-less-than.scss +0 -16
- data/tests/bootcamp/test/matchers/types/_be-falsy.scss +0 -14
- data/tests/bootcamp/test/matchers/types/_be-null.scss +0 -13
- data/tests/bootcamp/test/matchers/types/_be-truthy.scss +0 -13
- data/tests/bootcamp/test/matchers/types/_have-type-of.scss +0 -17
- data/tests/bootcamp/test/specs.scss +0 -45
- data/tests/bootcamp/test/utils/_contain.scss +0 -41
- data/tests/bootcamp/test/utils/_equal.scss +0 -79
- data/tests/bootcamp/test/utils/_list-join.scss +0 -39
- data/tests/bootcamp/test/utils/_power.scss +0 -13
- data/tests/sass-prof.log +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da3ec92bb2f4ff67d45ef97780e765c7f8374376
|
4
|
+
data.tar.gz: 737c9de82a35ab9df17646cf6107e2df2515bac1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d3e8716713e4ed5a3222e310bc1ea631e696a231021dc7a4e680a7d6392aeb7f065d32808e1d6d515b504484ee2edbbb89cfae3028f85279247bfa366e9bf14
|
7
|
+
data.tar.gz: 4cb75a699c69ed570c3fab5d24ea38c410c542693e1a017483184357cc7d6c0e1361f6319650f166bea97d9d7a8920bfb3e5fac463c595af92dfd0750d6dc281
|
data/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2014 Ezekiel Gabrielse
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Ezekiel Gabrielse
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,98 +1,99 @@
|
|
1
|
-
[![Flint - Grid System](http://flint.gs/wp-content/themes/flint/images/logo.png)](http://flint.gs)
|
2
|
-
|
3
|
-
[![Gem](https://img.shields.io/gem/v/flint-gs.svg?style=flat-square)](https://rubygems.org/gems/flint-gs)
|
4
|
-
[![Bower](https://img.shields.io/bower/v/flint.svg?style=flat-square)](http://bower.io/search/?q=flint)
|
5
|
-
[![
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
function parses
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
///
|
59
|
-
///
|
60
|
-
///
|
61
|
-
///
|
62
|
-
///
|
63
|
-
///
|
64
|
-
///
|
65
|
-
///
|
66
|
-
///
|
67
|
-
///
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
1
|
+
[![Flint - Grid System](http://flint.gs/wp-content/themes/flint/images/logo.png)](http://flint.gs)
|
2
|
+
|
3
|
+
[![Gem](https://img.shields.io/gem/v/flint-gs.svg?style=flat-square)](https://rubygems.org/gems/flint-gs)
|
4
|
+
[![Bower](https://img.shields.io/bower/v/flint.svg?style=flat-square)](http://bower.io/search/?q=flint)
|
5
|
+
[![Travis](https://img.shields.io/travis/ezekg/flint.svg?style=flat-square)](https://travis-ci.org/ezekg/flint)
|
6
|
+
[![GitHub license](https://img.shields.io/github/license/ezekg/flint.svg?style=flat-square)](https://github.com/ezekg/flint/blob/master/LICENSE)
|
7
|
+
|
8
|
+
## What is Flint?
|
9
|
+
Flint is a responsive grid framework written in Sass, created to allow developers to rapidly produce responsive layouts that are built on a sophisticated foundation.
|
10
|
+
|
11
|
+
## What sets Flint apart?
|
12
|
+
Most notably? The syntax. Being a designer myself, a large amount of time was spent on this aspect. Flint is very unique in the fact that it uses only a single mixin for all output: `_(...)`.
|
13
|
+
|
14
|
+
Yes, it really is just an underscore. Easy to remember, huh? It shoves the function mumbo-jumbo out of the way and allows you to focus on the aspect that matters most: the actual layout. It also allows you to type your intentions in human terms.
|
15
|
+
|
16
|
+
```scss
|
17
|
+
@include _(from tablet to desktop) { ... }
|
18
|
+
```
|
19
|
+
|
20
|
+
In addition to that, as you can tell from the snippet above, Flint also handles your breakpoints for you. Long gone are the days that you need to download a separate plugin just so that you're able to create a truly responsive layout.
|
21
|
+
|
22
|
+
Flint allows you create an unlimited number of breakpoints, all of which have their own alias, column count and breakpoint. Want to name your 10 breakpoints after James Bond villians? By all means, go ahead.
|
23
|
+
|
24
|
+
One more cool thing? Flint is the only self-aware Sass grid system on the planet.* What does that mean? It means that every instance of Flint is logged into an 'instance map', so child elements can know their parent element's width; meaning we can have perfectly consistent gutters, no matter how odd your layout may be. Think of it as a self-correcting grid.
|
25
|
+
|
26
|
+
[Check out this short introduction over at Sitepoint.com](http://www.sitepoint.com/rapid-responsive-development-sass-flint/), and take it for a spin on [SassMeister.com](http://sassmeister.com/gist/228449011362bcdfe38c)!
|
27
|
+
|
28
|
+
Enjoy.
|
29
|
+
|
30
|
+
## Requirements
|
31
|
+
|
32
|
+
* Sass ~> `3.4.0`
|
33
|
+
|
34
|
+
## Installation
|
35
|
+
|
36
|
+
1. Install via Ruby `gem install flint-gs`, or Bower `bower install flint --save-dev`
|
37
|
+
2. If you're using Compass, add `require "flint"` to your `config.rb`
|
38
|
+
3. Import it into your stylesheet with `@import "flint"`
|
39
|
+
|
40
|
+
If you're not using Compass, you can require Flint and compile via cli:
|
41
|
+
```
|
42
|
+
scss --require ./lib/flint.rb example.scss > example.css
|
43
|
+
```
|
44
|
+
|
45
|
+
## Documentation
|
46
|
+
|
47
|
+
Documentation is located [here](http://flint.gs/docs).
|
48
|
+
|
49
|
+
_Tip: For simple projects, disable `instance-maps`, as it is has a large overhead and will increase your compile times._
|
50
|
+
|
51
|
+
## Syntax support
|
52
|
+
|
53
|
+
As of `1.6.0`, you can add syntax support for your preferred syntax. I built the system for BEM, but it should be easily extendable to
|
54
|
+
support your preferred syntax. Simply create a function which parses a string of selectors into a valid list. For example, the BEM syntax
|
55
|
+
function parses the selector string (for example, `.block__element__element`) like so,
|
56
|
+
|
57
|
+
```scss
|
58
|
+
///
|
59
|
+
/// Parser to support BEM syntax
|
60
|
+
///
|
61
|
+
/// @access private
|
62
|
+
///
|
63
|
+
/// @param {List} $selectors - string of selectors to parse
|
64
|
+
///
|
65
|
+
/// @return {List} - parsed list of selectors according to syntax
|
66
|
+
///
|
67
|
+
/// @group Internal Functions
|
68
|
+
///
|
69
|
+
@function flint-support-syntax-bem($selectors) { ... }
|
70
|
+
```
|
71
|
+
[View Source](https://github.com/ezekg/flint/blob/master/stylesheets/flint/functions/lib/_support-syntax-bem.scss)
|
72
|
+
|
73
|
+
This will be parsed into a list of selectors: `.block, .block__element, .block__element__element`. The list of selectors can then be used by the
|
74
|
+
instance system to look up a selectors parent, etc. To support your own preferred syntax: create a `flint-support-syntax-<syntax-name>` function
|
75
|
+
and hook into it through the config `"support-syntax": "<syntax-name>"` option -- the system will attempt to use the `call()` function in
|
76
|
+
order to parse the selector string.
|
77
|
+
|
78
|
+
#### Officially supported syntaxes
|
79
|
+
* [BEM](http://bem.info/)
|
80
|
+
|
81
|
+
If you use one that isn't here, let me know and I'll look into officially supporting it.
|
82
|
+
|
83
|
+
## Support
|
84
|
+
|
85
|
+
You can tweet [@FlintGrid](https://twitter.com/FlintGrid) with any questions or issues and I'll look into it. Be sure to include a [Gist](https://gist.github.com) or a [SassMeister](http://sassmeister.com) link.
|
86
|
+
|
87
|
+
## Authors
|
88
|
+
|
89
|
+
[Ezekiel Gabrielse](http://ezekielg.com)
|
90
|
+
|
91
|
+
## Contributing
|
92
|
+
|
93
|
+
As an open-source project, contributions are more than welcome, they're extremely helpful and actively encouraged. If you see any room for improvement, open an [issue](https://github.com/ezekg/flint/issues) or submit a [pull request](https://github.com/ezekg/flint/pulls). Also, make sure to take a look at the [contributing doc](CONTRIBUTING.md).
|
94
|
+
|
95
|
+
## License
|
96
|
+
|
97
|
+
Flint is available under the [MIT](http://opensource.org/licenses/MIT) license.
|
98
|
+
|
99
|
+
_\* According to Wikipedia, not really. But, all jokes aside, it's pretty awesome._
|
data/lib/flint-gs.rb
ADDED
data/lib/flint.rb
CHANGED
@@ -1,16 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
lib = File.expand_path "../../lib/", __FILE__
|
4
|
+
$:.unshift lib unless $:.include? lib
|
5
|
+
|
6
|
+
require "sass"
|
7
|
+
|
8
|
+
require "flint/version"
|
9
|
+
require "flint/functions"
|
10
|
+
|
11
|
+
base_directory = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
12
|
+
flint_stylesheets_path = File.join(base_directory, 'stylesheets')
|
13
|
+
|
14
|
+
if (defined? Compass)
|
15
|
+
Compass::Frameworks.register('flint', :path => base_directory)
|
16
|
+
else
|
17
|
+
ENV["SASS_PATH"] = [ENV["SASS_PATH"], flint_stylesheets_path].compact.join(File::PATH_SEPARATOR)
|
18
|
+
end
|
19
|
+
|
20
|
+
module Flint
|
21
|
+
Sass::Script::Functions.send(:include, Flint)
|
22
|
+
end
|
data/lib/flint/functions.rb
CHANGED
@@ -1,99 +1,99 @@
|
|
1
|
-
module Flint
|
2
|
-
|
3
|
-
def self.declare(*args)
|
4
|
-
Sass::Script::Functions.declare(*args)
|
5
|
-
end
|
6
|
-
|
7
|
-
#
|
8
|
-
# Use ruby functions
|
9
|
-
#
|
10
|
-
# @return {Bool}
|
11
|
-
#
|
12
|
-
def flint_use_ruby()
|
13
|
-
Sass::Script::Bool.new(true)
|
14
|
-
end
|
15
|
-
|
16
|
-
#
|
17
|
-
# Fetch value from map
|
18
|
-
#
|
19
|
-
# @param {Map} map - map to fetch value from
|
20
|
-
# @param {ArgList} keys - list of keys to traverse
|
21
|
-
#
|
22
|
-
# @return {*}
|
23
|
-
#
|
24
|
-
def flint_ruby_map_fetch(map, *keys)
|
25
|
-
assert_type map, :Map, :map
|
26
|
-
|
27
|
-
result = map
|
28
|
-
keys.each { |key| result.nil? ? break : result = result.to_h.fetch(key, nil) }
|
29
|
-
|
30
|
-
unless result.nil?
|
31
|
-
result
|
32
|
-
else
|
33
|
-
Sass::Script::Bool.new(false)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
declare :flint_ruby_map_fetch, :args => [:map, :keys], :var_args => true
|
37
|
-
|
38
|
-
#
|
39
|
-
# Joins all elements of list with passed glue
|
40
|
-
#
|
41
|
-
# @param {List} list
|
42
|
-
# @param {String} glue
|
43
|
-
#
|
44
|
-
# @return {String}
|
45
|
-
#
|
46
|
-
def flint_ruby_list_to_str(list, glue)
|
47
|
-
assert_type list, :List, :list
|
48
|
-
assert_type glue, :String, :glue
|
49
|
-
|
50
|
-
arr = list.to_a.flatten.map { |item| item.value }
|
51
|
-
|
52
|
-
Sass::Script::String.new(arr.join(glue.value))
|
53
|
-
end
|
54
|
-
declare :flint_ruby_list_to_str, :args => [:list, :glue]
|
55
|
-
|
56
|
-
#
|
57
|
-
# Turn string into a flat list
|
58
|
-
#
|
59
|
-
# @param {String} string - string to operate on
|
60
|
-
# @param {String} separator - item to find which separates substrings
|
61
|
-
# @param {String} ignore - removes remaining string beyond item
|
62
|
-
#
|
63
|
-
# @return {List}
|
64
|
-
#
|
65
|
-
def flint_ruby_str_to_list(string, separator, ignore)
|
66
|
-
assert_type string, :String, :string
|
67
|
-
assert_type separator, :String, :separator
|
68
|
-
assert_type ignore, :String, :ignore
|
69
|
-
|
70
|
-
# Remove everything after ignore, split with separator
|
71
|
-
items = string.value[/[^#{ignore}]+/].split(separator.value)
|
72
|
-
|
73
|
-
if items.count == 1
|
74
|
-
Sass::Script::String.new(items[0], :comma)
|
75
|
-
else
|
76
|
-
Sass::Script::List.new(items.map { |i| Sass::Script::String.new(i) }, :comma)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
declare :flint_ruby_str_to_list, :args => [:string, :separator, :ignore]
|
80
|
-
|
81
|
-
#
|
82
|
-
# Replace substring with string
|
83
|
-
#
|
84
|
-
# @param {String} string - string that contains substring
|
85
|
-
# @param {String} find - substring to replace
|
86
|
-
# @param {String} replace - new string to replace sub with
|
87
|
-
#
|
88
|
-
# @return {String}
|
89
|
-
#
|
90
|
-
def flint_ruby_str_replace(string, find, replace)
|
91
|
-
assert_type string, :String, :string
|
92
|
-
assert_type find, :String, :find
|
93
|
-
assert_type replace, :String, :replace
|
94
|
-
|
95
|
-
Sass::Script::String.new(string.value.gsub(find.value, replace.value))
|
96
|
-
end
|
97
|
-
declare :flint_ruby_str_replace, :args => [:string, :find, :replace]
|
98
|
-
|
99
|
-
end
|
1
|
+
module Flint
|
2
|
+
|
3
|
+
def self.declare(*args)
|
4
|
+
Sass::Script::Functions.declare(*args)
|
5
|
+
end
|
6
|
+
|
7
|
+
#
|
8
|
+
# Use ruby functions
|
9
|
+
#
|
10
|
+
# @return {Bool}
|
11
|
+
#
|
12
|
+
def flint_use_ruby()
|
13
|
+
Sass::Script::Bool.new(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# Fetch value from map
|
18
|
+
#
|
19
|
+
# @param {Map} map - map to fetch value from
|
20
|
+
# @param {ArgList} keys - list of keys to traverse
|
21
|
+
#
|
22
|
+
# @return {*}
|
23
|
+
#
|
24
|
+
def flint_ruby_map_fetch(map, *keys)
|
25
|
+
assert_type map, :Map, :map
|
26
|
+
|
27
|
+
result = map
|
28
|
+
keys.each { |key| result.nil? ? break : result = result.to_h.fetch(key, nil) }
|
29
|
+
|
30
|
+
unless result.nil?
|
31
|
+
result
|
32
|
+
else
|
33
|
+
Sass::Script::Bool.new(false)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
declare :flint_ruby_map_fetch, :args => [:map, :keys], :var_args => true
|
37
|
+
|
38
|
+
#
|
39
|
+
# Joins all elements of list with passed glue
|
40
|
+
#
|
41
|
+
# @param {List} list
|
42
|
+
# @param {String} glue
|
43
|
+
#
|
44
|
+
# @return {String}
|
45
|
+
#
|
46
|
+
def flint_ruby_list_to_str(list, glue)
|
47
|
+
assert_type list, :List, :list
|
48
|
+
assert_type glue, :String, :glue
|
49
|
+
|
50
|
+
arr = list.to_a.flatten.map { |item| item.value }
|
51
|
+
|
52
|
+
Sass::Script::String.new(arr.join(glue.value))
|
53
|
+
end
|
54
|
+
declare :flint_ruby_list_to_str, :args => [:list, :glue]
|
55
|
+
|
56
|
+
#
|
57
|
+
# Turn string into a flat list
|
58
|
+
#
|
59
|
+
# @param {String} string - string to operate on
|
60
|
+
# @param {String} separator - item to find which separates substrings
|
61
|
+
# @param {String} ignore - removes remaining string beyond item
|
62
|
+
#
|
63
|
+
# @return {List}
|
64
|
+
#
|
65
|
+
def flint_ruby_str_to_list(string, separator, ignore)
|
66
|
+
assert_type string, :String, :string
|
67
|
+
assert_type separator, :String, :separator
|
68
|
+
assert_type ignore, :String, :ignore
|
69
|
+
|
70
|
+
# Remove everything after ignore, split with separator
|
71
|
+
items = string.value[/[^#{ignore}]+/].split(separator.value)
|
72
|
+
|
73
|
+
if items.count == 1
|
74
|
+
Sass::Script::String.new(items[0], :comma)
|
75
|
+
else
|
76
|
+
Sass::Script::List.new(items.map { |i| Sass::Script::String.new(i) }, :comma)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
declare :flint_ruby_str_to_list, :args => [:string, :separator, :ignore]
|
80
|
+
|
81
|
+
#
|
82
|
+
# Replace substring with string
|
83
|
+
#
|
84
|
+
# @param {String} string - string that contains substring
|
85
|
+
# @param {String} find - substring to replace
|
86
|
+
# @param {String} replace - new string to replace sub with
|
87
|
+
#
|
88
|
+
# @return {String}
|
89
|
+
#
|
90
|
+
def flint_ruby_str_replace(string, find, replace)
|
91
|
+
assert_type string, :String, :string
|
92
|
+
assert_type find, :String, :find
|
93
|
+
assert_type replace, :String, :replace
|
94
|
+
|
95
|
+
Sass::Script::String.new(string.value.gsub(find.value, replace.value))
|
96
|
+
end
|
97
|
+
declare :flint_ruby_str_replace, :args => [:string, :find, :replace]
|
98
|
+
|
99
|
+
end
|