semantic-ui-sass 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +14 -0
- data/README.md +45 -5
- data/Rakefile +6 -3
- data/lib/semantic-ui-sass.rb +22 -0
- data/lib/semantic/ui/sass/version.rb +1 -1
- data/semantic-ui-sass.gemspec +3 -0
- data/tasks/converter.rb +88 -70
- data/templates/project/manifest.rb +29 -0
- data/templates/project/styles.scss +1 -0
- metadata +48 -3
- data/lib/semantic/ui/sass.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43548f63a28e7e11f587faf299202548528b327f
|
4
|
+
data.tar.gz: 7efdd6a498a980adbb31e8ec372de93243bf60db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af2ca59c8266fe91899a2767637c712de8e40d877f6b6e6737a831b46bbf52e98ab0b1c59b5fbb9ecf6390a361014ac763d3d2642609466cb4cc184be2c9a62e
|
7
|
+
data.tar.gz: 3e314de76d1e3ff90864a148a1ee7a542057bc848233bbc19d088ce44ff96ee5324092dbb1b3bd0207c4fa3699db61386096c11390616301d4337816da75e4f1
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,18 +1,23 @@
|
|
1
1
|
# Semantic UI for Sass
|
2
2
|
|
3
|
-
`semantic-ui-sass` is an Sass-powered version of [Semantic UI](https://github.com/jlukic/Semantic-UI).
|
3
|
+
`semantic-ui-sass` is an Sass-powered version of [Semantic UI](https://github.com/jlukic/Semantic-UI) and ready to drop into Rails & Compass.
|
4
4
|
|
5
5
|
## Installation and Usage
|
6
6
|
|
7
7
|
```ruby
|
8
|
-
gem 'semantic-ui-sass', '~> 0.0.
|
8
|
+
gem 'semantic-ui-sass', '~> 0.0.2'
|
9
|
+
```
|
10
|
+
or
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'semantic-ui-sass', github: 'doabit/semantic-ui-sass'
|
9
14
|
```
|
10
15
|
|
11
16
|
`bundle install` and restart your server to make the files available through the pipeline.
|
12
17
|
|
13
|
-
|
18
|
+
# semantic-ui-sass with Rails
|
14
19
|
|
15
|
-
|
20
|
+
## CSS
|
16
21
|
|
17
22
|
Import Semantic in an SCSS file (for example, `application.css.scss`) to get all of Semantic's styles
|
18
23
|
|
@@ -26,7 +31,7 @@ You can also include modules
|
|
26
31
|
@import "semantic-ui/collections/menu";
|
27
32
|
```
|
28
33
|
|
29
|
-
|
34
|
+
## Javascripts
|
30
35
|
|
31
36
|
We have a helper that includes all Semantic javascripts. Put this in your Javascript manifest (usually in `application.js`) to
|
32
37
|
|
@@ -42,6 +47,41 @@ You can also load individual modules, provided you also require any dependencies
|
|
42
47
|
//= require semantic-ui/dropdown
|
43
48
|
```
|
44
49
|
|
50
|
+
# semantic-ui-sass with Compass
|
51
|
+
|
52
|
+
## New project
|
53
|
+
|
54
|
+
Install the gem and create a new project using the gem.
|
55
|
+
|
56
|
+
```console
|
57
|
+
gem install semantic-ui-sass
|
58
|
+
compass create compass-project -r semantic-ui-sass --using semantic-ui
|
59
|
+
```
|
60
|
+
|
61
|
+
This will sort a few things out:
|
62
|
+
|
63
|
+
* You'll get a starting `styles.scss`
|
64
|
+
* You'll get a compiled stylesheet compiled & ready to drop into your application
|
65
|
+
* We'll also copy the Semantic javascripts & images & fonts into their respective folders for you
|
66
|
+
|
67
|
+
## Existing project
|
68
|
+
|
69
|
+
Install the gem, add the require statement to the top of your configuration file, and install the extension.
|
70
|
+
|
71
|
+
```console
|
72
|
+
gem install semantic-ui-sass
|
73
|
+
```
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
# In config.rb
|
77
|
+
require 'semantic-ui-sass'
|
78
|
+
```
|
79
|
+
|
80
|
+
```console
|
81
|
+
compass install semantic-ui
|
82
|
+
```
|
83
|
+
|
84
|
+
|
45
85
|
## Contributing
|
46
86
|
|
47
87
|
1. Fork it
|
data/Rakefile
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
desc 'Convert semantic-ui less to sass'
|
4
|
+
task :convert, :branch do |t, args|
|
5
|
+
require './tasks/converter'
|
6
|
+
branch = args[:branch]
|
7
|
+
Converter.new(branch).process
|
5
8
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Semantic
|
2
|
+
module Ui
|
3
|
+
module Sass
|
4
|
+
class FrameworkNotFound < StandardError; end
|
5
|
+
|
6
|
+
if defined?(::Rails)
|
7
|
+
require 'semantic/ui/sass/engine'
|
8
|
+
end
|
9
|
+
|
10
|
+
if defined?(::Compass)
|
11
|
+
base = File.join(File.dirname(__FILE__), '..')
|
12
|
+
styles = File.join(base, 'app', 'assets', 'stylesheets')
|
13
|
+
templates = File.join(base, 'templates')
|
14
|
+
::Compass::Frameworks.register('semantic-ui', :path => base, :stylesheets_directory => styles, :templates_directory => templates)
|
15
|
+
end
|
16
|
+
|
17
|
+
if !(defined?(::Rails) || defined?(::Compass))
|
18
|
+
raise Semantic::Ui::Sass::FrameworkNotFound, "semantic-ui-sass requires either Rails > 3.1 or Compass, neither of which are loaded"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/semantic-ui-sass.gemspec
CHANGED
@@ -21,4 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_runtime_dependency 'sass', '~> 3.2'
|
24
|
+
spec.add_development_dependency 'sass-rails', '>= 3.2'
|
25
|
+
spec.add_development_dependency 'pry'
|
26
|
+
spec.add_development_dependency 'dotenv'
|
24
27
|
end
|
data/tasks/converter.rb
CHANGED
@@ -1,19 +1,34 @@
|
|
1
1
|
# Based on convert script from vwall/compass-twitter-bootstrap gem.
|
2
|
-
# https://github.com/vwall/compass-twitter-bootstrap/blob/
|
2
|
+
# https://github.com/vwall/compass-twitter-bootstrap/blob/#{@branch}/build/convert.rb
|
3
3
|
|
4
4
|
require 'open-uri'
|
5
5
|
require 'json'
|
6
6
|
require 'fileutils'
|
7
|
+
require "pry"
|
8
|
+
require "dotenv"
|
9
|
+
Dotenv.load
|
7
10
|
|
8
11
|
class Converter
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
GIT_DATA = 'https://api.github.com/repos'
|
14
|
+
GIT_RAW = 'https://raw.github.com'
|
15
|
+
TOKEN = ENV['TOKEN']
|
16
|
+
|
17
|
+
def initialize(branch)
|
18
|
+
@repo = 'jlukic/Semantic-UI'
|
19
|
+
@repo_url = "https://github.com/#@repo"
|
20
|
+
@branch = branch || 'master'
|
21
|
+
@git_data_trees = "#{GIT_DATA}/#{@repo}/git/trees"
|
22
|
+
@git_raw_src = "#{GIT_RAW}/#{@repo}/#{@branch}/src"
|
23
|
+
@branch_sha = get_tree_sha
|
24
|
+
@less_paths = ['collections', 'elements', 'views', 'modules']
|
25
|
+
@js_paths = ['modules', 'behavior']
|
26
|
+
@fonts_images_paths = ['fonts', 'images']
|
27
|
+
@save_at = { js: 'app/assets/javascripts/semantic-ui',
|
28
|
+
scss: 'app/assets/stylesheets/semantic-ui',
|
29
|
+
images: 'app/assets/images/semantic-ui',
|
30
|
+
fonts: 'app/assets/fonts/semantic-ui'
|
31
|
+
}
|
17
32
|
end
|
18
33
|
|
19
34
|
def process
|
@@ -25,64 +40,48 @@ class Converter
|
|
25
40
|
|
26
41
|
def process_stylesheets_assets
|
27
42
|
main_content = ''
|
28
|
-
|
43
|
+
semantic_ui_less_paths.each do |path, sha|
|
29
44
|
content = ''
|
30
|
-
|
45
|
+
semantic_ui_less_files(sha).each do |name|
|
31
46
|
file_name = name.gsub('.less', '')
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
save_file(name, file, path)
|
37
|
-
content += "@import '#{file_name}';\n"
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
if @paths.include?(path)
|
43
|
-
save_file('all', content, path)
|
44
|
-
main_content += "@import 'semantic-ui/#{path}/all';\n";
|
47
|
+
file = open_git_file("#{@git_raw_src}/#{path}/#{name}")
|
48
|
+
file = convert(file)
|
49
|
+
save_file(name, file, path)
|
50
|
+
content += "@import '#{file_name}';\n"
|
45
51
|
end
|
52
|
+
save_file('all', content, path)
|
53
|
+
main_content += "@import 'semantic-ui/#{path}/all';\n";
|
46
54
|
end
|
47
|
-
|
48
|
-
f = File.open(file, "w+")
|
49
|
-
f.write(main_content)
|
50
|
-
f.close
|
55
|
+
File.open("app/assets/stylesheets/semantic-ui.scss", "w+") { |file| file.write(main_content) }
|
51
56
|
end
|
52
57
|
|
53
58
|
def process_javascript_assets
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
content = ''
|
60
|
+
semantic_ui_js_paths.each do |path, sha|
|
61
|
+
semantic_ui_js_files(sha).each do |name|
|
57
62
|
file_name = name.gsub('.js', '')
|
58
|
-
|
59
|
-
|
60
|
-
file
|
61
|
-
save_file(name, file, path, 'js')
|
63
|
+
if path == 'modules'
|
64
|
+
file = open_git_file("#{@git_raw_src}/#{path}/#{name}")
|
65
|
+
save_file(name, file, nil, 'js')
|
62
66
|
content += "//= require semantic-ui/#{file_name}\n"
|
67
|
+
else
|
68
|
+
file = open_git_file("#{@git_raw_src}/modules/behavior/#{name}")
|
69
|
+
save_file(name, file, 'behavior', 'js')
|
70
|
+
content += "//= require semantic-ui/behavior/#{file_name}\n"
|
63
71
|
end
|
64
72
|
end
|
65
|
-
if path == 'modules'
|
66
|
-
file = "app/assets/javascripts/semantic-ui.js"
|
67
|
-
f = File.open(file, "w+")
|
68
|
-
f.write(content)
|
69
|
-
f.close
|
70
|
-
end
|
71
73
|
end
|
74
|
+
File.open("app/assets/javascripts/semantic-ui.js", "w+") { |file| file.write(content) }
|
72
75
|
end
|
73
76
|
|
74
77
|
def process_images_and_fonts_assets
|
75
|
-
|
76
|
-
|
77
|
-
get_less_files(sha).each do |name|
|
78
|
+
semantic_ui_fonts_images_paths.each do |path, sha|
|
79
|
+
semantic_ui_fonts_images_files(sha).each do |name|
|
78
80
|
file_name = name.gsub('.less', '')
|
79
|
-
|
80
|
-
|
81
|
-
save_file(name, file, path, path)
|
82
|
-
end
|
81
|
+
file = open_git_file("#{@git_raw_src}/#{path}/#{name}")
|
82
|
+
save_file(name, file, nil, path)
|
83
83
|
end
|
84
84
|
end
|
85
|
-
|
86
85
|
end
|
87
86
|
|
88
87
|
|
@@ -91,21 +90,41 @@ private
|
|
91
90
|
# Get the sha of less branch
|
92
91
|
def get_tree_sha
|
93
92
|
sha = nil
|
94
|
-
trees =
|
95
|
-
trees = JSON.parse trees
|
93
|
+
trees = get_json("#{@git_data_trees}/#{@branch}")
|
96
94
|
trees['tree'].find{|t| t['path'] == 'src'}['sha']
|
97
95
|
end
|
98
96
|
|
99
|
-
def
|
100
|
-
paths =
|
101
|
-
paths
|
102
|
-
|
97
|
+
def semantic_ui_less_paths
|
98
|
+
paths = get_json("#{@git_data_trees}/#{get_tree_sha}")
|
99
|
+
paths['tree'].select{|f| f['type'] == 'tree' && @less_paths.include?(f['path']) }.map{|f| [f['path'], f['sha']] }
|
100
|
+
end
|
101
|
+
|
102
|
+
def semantic_ui_less_files(sha)
|
103
|
+
files = get_json("#{@git_data_trees}/#{sha}")
|
104
|
+
files['tree'].select{|f| f['type'] == 'blob' && f['path'] =~ /\.less$/ }.map{|f| f['path'] }
|
105
|
+
end
|
106
|
+
|
107
|
+
def semantic_ui_js_paths
|
108
|
+
paths = get_json("#{@git_data_trees}/#{get_tree_sha}")
|
109
|
+
paths = paths['tree'].select{|f| f['type'] == 'tree' && @js_paths.include?(f['path']) }.map{|f| [f['path'], f['sha']] }
|
110
|
+
behavior_paths = get_json("#{@git_data_trees}/#{paths[0][1]}")
|
111
|
+
behavior_paths = behavior_paths['tree'].select{|f| f['type'] == 'tree' && f['path'] == 'behavior' }.map{|f| [f['path'], f['sha']] }
|
112
|
+
js_paths = paths + behavior_paths
|
103
113
|
end
|
104
114
|
|
105
|
-
def
|
106
|
-
|
107
|
-
|
108
|
-
|
115
|
+
def semantic_ui_js_files(sha)
|
116
|
+
files = get_json("#{@git_data_trees}/#{sha}")
|
117
|
+
files['tree'].select{|f| f['type'] == 'blob' && f['path'] =~ /\.js$/ }.map{|f| f['path'] }
|
118
|
+
end
|
119
|
+
|
120
|
+
def semantic_ui_fonts_images_paths
|
121
|
+
paths = get_json("#{@git_data_trees}/#{get_tree_sha}")
|
122
|
+
paths['tree'].select{|f| f['type'] == 'tree' && @fonts_images_paths.include?(f['path']) }.map{|f| [f['path'], f['sha']] }
|
123
|
+
end
|
124
|
+
|
125
|
+
def semantic_ui_fonts_images_files(sha)
|
126
|
+
files = get_json("#{@git_data_trees}/#{sha}")
|
127
|
+
files['tree'].select{|f| f['type'] == 'blob'}.map{|f| f['path'] }
|
109
128
|
end
|
110
129
|
|
111
130
|
|
@@ -138,17 +157,18 @@ private
|
|
138
157
|
name = name.gsub(/\.less/, '')
|
139
158
|
file = "#{@save_at[:scss]}/#{path}/_#{name}.scss"
|
140
159
|
when 'js', 'images', 'fonts'
|
141
|
-
|
142
|
-
file = "#{@save_at[type.to_sym]}/#{name}"
|
160
|
+
file = (path.nil? ? "#{@save_at[type.to_sym]}/#{name}" : "#{@save_at[type.to_sym]}/#{path}/#{name}")
|
143
161
|
end
|
144
162
|
dir = File.dirname(file)
|
145
|
-
unless File.directory?(file)
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
163
|
+
FileUtils.mkdir_p(dir) unless File.directory?(file)
|
164
|
+
File.open(file, 'w+') { |f| f.write(content) }
|
165
|
+
puts "Saved #{name} at #{path}\n"
|
166
|
+
end
|
167
|
+
|
168
|
+
def get_json(url)
|
169
|
+
url += "?access_token=#{TOKEN}" unless TOKEN.nil?
|
170
|
+
data = open_git_file(url)
|
171
|
+
data = JSON.parse data
|
152
172
|
end
|
153
173
|
|
154
174
|
def store_version
|
@@ -232,6 +252,4 @@ private
|
|
232
252
|
scss.gsub(/^(\$.+);$/, '\1 !default;')
|
233
253
|
end
|
234
254
|
|
235
|
-
end
|
236
|
-
|
237
|
-
Converter.new.process
|
255
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
description "Semantic UI for Sass"
|
2
|
+
|
3
|
+
# Stylesheet importing semantic
|
4
|
+
stylesheet 'styles.scss'
|
5
|
+
|
6
|
+
# Other Semantic UI assets
|
7
|
+
basedir = '../../app/assets'
|
8
|
+
image_dir = "#{basedir}/images/semantic-ui"
|
9
|
+
javascript_dir = ["#{basedir}/javascripts/semantic-ui", "#{basedir}/javascripts/semantic-ui/behavior"]
|
10
|
+
font_dir = "#{basedir}/fonts/semantic-ui"
|
11
|
+
|
12
|
+
|
13
|
+
Dir[File.join(File.dirname(__FILE__), image_dir, '*.gif')].each do |file|
|
14
|
+
filename = File.basename(file)
|
15
|
+
image "#{image_dir}/#{filename}", to: "semantic-ui/#{filename}"
|
16
|
+
end
|
17
|
+
|
18
|
+
javascript_dir.each do |dir|
|
19
|
+
Dir[File.join(File.dirname(__FILE__), dir, '*.js')].each do |file|
|
20
|
+
filename = File.basename(file)
|
21
|
+
to_path = dir.include?('behavior') ? "semantic-ui/behavior/#{filename}" : "semantic-ui/#{filename}"
|
22
|
+
javascript "#{dir}/#{filename}", to: to_path
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Dir[File.join(File.dirname(__FILE__), font_dir, '*')].each do |file|
|
27
|
+
filename = File.basename(file)
|
28
|
+
font "#{font_dir}/#{filename}", to: "semantic-ui/#{filename}"
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
@import 'semantic-ui';
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic-ui-sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- doabit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,48 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sass-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
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: dotenv
|
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'
|
55
97
|
description: Semantic UI, converted to Sass and ready to drop into Rails.
|
56
98
|
email:
|
57
99
|
- doinsist@gmail.com
|
@@ -60,6 +102,7 @@ extensions: []
|
|
60
102
|
extra_rdoc_files: []
|
61
103
|
files:
|
62
104
|
- .gitignore
|
105
|
+
- CHANGELOG.md
|
63
106
|
- Gemfile
|
64
107
|
- LICENSE.txt
|
65
108
|
- README.md
|
@@ -145,11 +188,13 @@ files:
|
|
145
188
|
- app/assets/stylesheets/semantic-ui/views/_item.scss
|
146
189
|
- app/assets/stylesheets/semantic-ui/views/_list.scss
|
147
190
|
- app/assets/stylesheets/semantic-ui/views/_statistic.scss
|
148
|
-
- lib/semantic
|
191
|
+
- lib/semantic-ui-sass.rb
|
149
192
|
- lib/semantic/ui/sass/engine.rb
|
150
193
|
- lib/semantic/ui/sass/version.rb
|
151
194
|
- semantic-ui-sass.gemspec
|
152
195
|
- tasks/converter.rb
|
196
|
+
- templates/project/manifest.rb
|
197
|
+
- templates/project/styles.scss
|
153
198
|
homepage: http://github.com/doabit/semantic-ui-sass
|
154
199
|
licenses:
|
155
200
|
- MIT
|