sinatra-autosass 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +38 -0
- data/lib/sinatra/autosass.rb +16 -0
- data/lib/sinatra/sassconvert.rb +28 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 67b655a4e3d28acb9e0fa35cef4cbb119ab1cd3f
|
4
|
+
data.tar.gz: 33ed25c52209ec9607b601d7c84faac363f644a1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f48bbf6af43b3147ced0828555555d43aadcc83c54399ce94b31a2763eb8f4b896962fbf8cd18c27b3288551135341f1a2aef14b76a8cda80529be38ec93e2f0
|
7
|
+
data.tar.gz: 3c7e0c92fa5b0fd2100b090008914cc6a0f1b3e5f3b5f4ab275cea92026d4d3edef40d402dba1b147fe21c5cd227182a27a0cfda32cff7430a1a8ba21a1cb380
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) <2014> <Zisis Maras>
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
Simple sinatra extension to automatically recompile all your sass/scss files everytime your application starts
|
2
|
+
|
3
|
+
Install with
|
4
|
+
```ruby
|
5
|
+
gem install sinatra-autosass
|
6
|
+
```
|
7
|
+
|
8
|
+
For classic applications
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
require 'sinatra'
|
12
|
+
require 'sinatra/autosass'
|
13
|
+
set :extension, 'scss' #use sass/scss , defaults to scss
|
14
|
+
set :sass_dir, 'public/scss/' #defaults to public/scss/
|
15
|
+
set :css_dir, 'public/css/' #defaults to public/css/
|
16
|
+
|
17
|
+
#application code
|
18
|
+
```
|
19
|
+
|
20
|
+
For modular applications
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
require 'sinatra/base'
|
24
|
+
require 'sinatra/autosass'
|
25
|
+
class MyApp < Sinatra::Application
|
26
|
+
register Sinatra::AutoSass
|
27
|
+
set :extension, 'scss' #use sass/scss , defaults to scss
|
28
|
+
set :sass_dir, 'public/scss/' #defaults to public/scss/
|
29
|
+
set :css_dir, 'public/css/' #defaults to public/css/
|
30
|
+
|
31
|
+
#application code
|
32
|
+
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
|
37
|
+
Licensed under MIT.
|
38
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require_relative 'sassconvert.rb'
|
3
|
+
|
4
|
+
module Sinatra
|
5
|
+
module AutoSass
|
6
|
+
def self.registered(app)
|
7
|
+
app.set :extension, 'scss'
|
8
|
+
app.set :sass_dir, 'public/scss/'
|
9
|
+
app.set :css_dir, 'public/css/'
|
10
|
+
app.before do
|
11
|
+
SassConvert.new(settings.sass_dir, settings.css_dir, settings.extension)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
register AutoSass
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class SassConvert
|
2
|
+
|
3
|
+
def initialize(sass_dir, css_dir, extension)
|
4
|
+
@extension = extension
|
5
|
+
@sass_dir = sass_dir
|
6
|
+
@css_dir = css_dir
|
7
|
+
append_trail
|
8
|
+
Dir.new("#{sass_dir}/").each do |file|
|
9
|
+
if file =~ /[a-z]*.#{extension}/
|
10
|
+
convert(file)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def convert(file)
|
16
|
+
command = "sass #{@sass_dir}#{file} #{@css_dir}#{file.gsub(@extension, 'css')}"
|
17
|
+
system(command)
|
18
|
+
end
|
19
|
+
|
20
|
+
def append_trail
|
21
|
+
@sass_dir += '/' if @sass_dir.split(//).last != '/'
|
22
|
+
@css_dir += '/' if @css_dir.split(//).last != '/'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sinatra-autosass
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zisis Maras
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-15 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.3'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.3.7
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.3'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.3.7
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: sinatra
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.4'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.4.5
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.4'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.4.5
|
53
|
+
description: Sinatra extension to automatically recompile all your sass/scss files
|
54
|
+
everytime your application starts
|
55
|
+
email: zisismaras@gmail.com
|
56
|
+
executables: []
|
57
|
+
extensions: []
|
58
|
+
extra_rdoc_files: []
|
59
|
+
files:
|
60
|
+
- Gemfile
|
61
|
+
- LICENSE
|
62
|
+
- README.md
|
63
|
+
- lib/sinatra/autosass.rb
|
64
|
+
- lib/sinatra/sassconvert.rb
|
65
|
+
homepage: https://github.com/zisismaras/sinatra-autosass
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.2.2
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Automatically recompile all your sass/scss files
|
89
|
+
test_files: []
|