sass-yaml 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +5 -0
- data/README.md +43 -0
- data/config/config.yml +12 -0
- data/lib/sass-yaml.rb +30 -0
- data/sass-yaml.gemspec +20 -0
- data/test/fixtures/config/config.yml +4 -0
- data/test/fixtures/screen.scss +5 -0
- metadata +67 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Y2ZjNmUzZWFjZjA3NGMzZGFiM2U0NDY2MDEyNmEyY2IzNmY0NTg3NQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YjRkZDY5MDQ3ZTA4MDliNDViNDJmYTY1YWZmMTY3ODI1ZTJlMmEwZg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzBjOTczMDRjZWQ4MmYxOWRhZWRmNDhlZjIxNjBlMjczNzAyMmU4NzM2ZGNi
|
10
|
+
MzM3YTM5ZjE5NzQ2NWE2NjA3N2FlOGYxOTM1NTgyNjM2MmMzNDU0MzMxOGJj
|
11
|
+
OWU0OTcxZDdiMzgwNWJlNzY4OTZmYWUxZjQwN2YzZDY5ZjhhY2I=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmQ0ZjJhM2RhZWZiYjUwMWRiYmQ2MDY1YTQzMzcwNjc1NDlkNzIyNzI2MWEx
|
14
|
+
NGRkNzVjZTUxMjAwYzExYzkxNmViMTgzNWVhNmI3MGU1MWNmNmViMGE2YjBk
|
15
|
+
ZjEwZjdiMzdiYzY5MjhmMTBhZDJlOWM3OGYyN2RlNzkwZjEwZGI=
|
data/.gitignore
ADDED
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
sass-yaml
|
2
|
+
=========
|
3
|
+
|
4
|
+
A gem that make easy access to Yaml from Sass
|
5
|
+
|
6
|
+
## Purpose of this gem
|
7
|
+
|
8
|
+
Creating a **styleguide** requires a great approach to design thinking and a rich frontend toolbox too.
|
9
|
+
My experience brought me the need of having a framework that help me keep **consistent** the content and the css generated.
|
10
|
+
|
11
|
+
I started using Yaml files to store static content for a static styleguide (a list of news, the range of typography weights, the range of colors ...).
|
12
|
+
Following some principles of OOCSS I started created blocks of css strictly related to the content, or better, the meaning of that content.
|
13
|
+
|
14
|
+
Keep alingned the CSS and the content became a great challenge to me.
|
15
|
+
This is why I needed to create this gem and why I'm looking for help.
|
16
|
+
|
17
|
+
### Installation
|
18
|
+
|
19
|
+
$ gem install sass-yaml
|
20
|
+
|
21
|
+
### Use with the Sass command line
|
22
|
+
|
23
|
+
$ sass -r sass-yaml your_file.scss
|
24
|
+
|
25
|
+
### Use with compass
|
26
|
+
|
27
|
+
Add the following to your compass configuration:
|
28
|
+
|
29
|
+
require 'sass-yaml'
|
30
|
+
|
31
|
+
## Example of Usage
|
32
|
+
|
33
|
+
Imagine you want to create a Scale of Typography like this:
|
34
|
+
http://erskinedesign.com/blog/setting-typographic-scale-with-sass-maps/
|
35
|
+
|
36
|
+
After you have created your Sass you'll need an HTML to test this, right?
|
37
|
+
Something like this:
|
38
|
+
|
39
|
+
<div class="typo x-small">Typo X-SMALL</div>
|
40
|
+
<div class="typo small">Typo SMALL</div>
|
41
|
+
<div class="typo base">Typo BASE</div>
|
42
|
+
<div class="typo large">Typo LARGE</div>
|
43
|
+
|
data/config/config.yml
ADDED
data/lib/sass-yaml.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Sass::Script::Functions
|
4
|
+
def yaml(variable)
|
5
|
+
config_file = 'config/config.yml'
|
6
|
+
|
7
|
+
if (File.file?(config_file))
|
8
|
+
obj = YAML.load_file(config_file)
|
9
|
+
if !obj['variables'][variable.to_s].nil?
|
10
|
+
value = obj['variables'][variable.to_s]
|
11
|
+
if(value.is_a?(String))
|
12
|
+
return Sass::Script::Value::String.new(value.to_s)
|
13
|
+
elsif (value.is_a?(Array))
|
14
|
+
value.each_with_index do |elem, i|
|
15
|
+
value[i]= Sass::Script::Value::String.new(elem.to_s)
|
16
|
+
end
|
17
|
+
return Sass::Script::Value::List.new(value, ",")
|
18
|
+
elsif (value.is_a?(Hash))
|
19
|
+
return Sass::Script::Value::Map.new(value)
|
20
|
+
end
|
21
|
+
else
|
22
|
+
return Sass::Script::Value::String.new('not-exists')
|
23
|
+
end
|
24
|
+
else
|
25
|
+
p 'Config File not exists. We are looking for a config/config.yml'
|
26
|
+
end
|
27
|
+
|
28
|
+
return Sass::Script::Value::String.new('auto')
|
29
|
+
end
|
30
|
+
end
|
data/sass-yaml.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "sass-yaml"
|
6
|
+
s.version = "0.0.1"
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Fabio Fabbrucci"]
|
9
|
+
s.email = ["fabio.fabbrucci@gmail.com"]
|
10
|
+
s.homepage = "http://fabiofabbrucci.github.com/"
|
11
|
+
s.summary = %q{Allows use of Yaml in Sass.}
|
12
|
+
s.description = %q{With this GEM you can easly query a Yaml file from your SASS.}
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_runtime_dependency 'sass', '>= 3.1'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sass-yaml
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabio Fabbrucci
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sass
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
description: With this GEM you can easly query a Yaml file from your SASS.
|
28
|
+
email:
|
29
|
+
- fabio.fabbrucci@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- README.md
|
36
|
+
- config/config.yml
|
37
|
+
- lib/sass-yaml.rb
|
38
|
+
- sass-yaml.gemspec
|
39
|
+
- test/fixtures/config/config.yml
|
40
|
+
- test/fixtures/screen.scss
|
41
|
+
homepage: http://fabiofabbrucci.github.com/
|
42
|
+
licenses:
|
43
|
+
- MIT
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.0.3
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: Allows use of Yaml in Sass.
|
65
|
+
test_files:
|
66
|
+
- test/fixtures/config/config.yml
|
67
|
+
- test/fixtures/screen.scss
|