sasset 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +2 -0
- data/LICENSE +19 -0
- data/README.md +41 -0
- data/Rakefile +2 -0
- data/lib/sasset.rb +30 -0
- data/sasset.gemspec +23 -0
- metadata +87 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2010 Alexander Kern
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
Sasset
|
2
|
+
======
|
3
|
+
|
4
|
+
Asset hosts with SASS/SCSS
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
Add this to your `Gemfile`:
|
10
|
+
|
11
|
+
gem 'sasset'
|
12
|
+
|
13
|
+
Then run `bundle install`.
|
14
|
+
|
15
|
+
Usage
|
16
|
+
-----
|
17
|
+
|
18
|
+
First, in your `config/application.rb` file, set your asset host.
|
19
|
+
|
20
|
+
Sasset.asset_host = 'http://example.com'
|
21
|
+
|
22
|
+
This can also be a Proc. It works the same way as `ActionController::Base.asset_host`
|
23
|
+
so feel free to set them to the same thing. See [ActionView::Helpers::AssetTagHelper](http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html)
|
24
|
+
for more information.
|
25
|
+
|
26
|
+
Now anywhere in your SASS/SCSS, you can now use the `asset-url()` function.
|
27
|
+
|
28
|
+
// Compiles to: background-image: url('http://example.com/bg.png');
|
29
|
+
background-image: asset-url('bg.png');
|
30
|
+
|
31
|
+
Cool stuff.
|
32
|
+
|
33
|
+
Author
|
34
|
+
------
|
35
|
+
|
36
|
+
Sasset is written by [Alexander Kern](http://kernpedia.com).
|
37
|
+
|
38
|
+
License
|
39
|
+
-------
|
40
|
+
|
41
|
+
See the LICENSE file for details (it's the MIT License).
|
data/Rakefile
ADDED
data/lib/sasset.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'sass'
|
2
|
+
|
3
|
+
module Sasset
|
4
|
+
VERSION = '1.0.0'
|
5
|
+
|
6
|
+
class << self
|
7
|
+
attr_accessor :asset_host
|
8
|
+
|
9
|
+
def asset_url(source)
|
10
|
+
if asset_host.respond_to? :call
|
11
|
+
prefix = asset_host.call(source)
|
12
|
+
else
|
13
|
+
prefix = asset_host || ''
|
14
|
+
end
|
15
|
+
|
16
|
+
File.join(prefix, source)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module Functions
|
21
|
+
def asset_url(asset)
|
22
|
+
url = Sasset.asset_url(asset.value)
|
23
|
+
Sass::Script::String.new("url('#{url}')")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module Sass::Script::Functions
|
29
|
+
include Sasset::Functions
|
30
|
+
end
|
data/sasset.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'sasset'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'sasset'
|
7
|
+
s.version = Sasset::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ['Alexander Kern']
|
10
|
+
s.email = ['alex@kernul.com']
|
11
|
+
s.homepage = 'http://github.com/CapnKernul/sasset'
|
12
|
+
s.summary = %q{Asset hosts with SASS/SCSS}
|
13
|
+
s.description = %q{Allows multiple asset hosts to be used with SASS/SCSS}
|
14
|
+
|
15
|
+
s.rubyforge_project = 'sasset'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
|
22
|
+
s.add_dependency 'sass'
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sasset
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Alexander Kern
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-06 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: sass
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Allows multiple asset hosts to be used with SASS/SCSS
|
36
|
+
email:
|
37
|
+
- alex@kernul.com
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- LICENSE
|
48
|
+
- README.md
|
49
|
+
- Rakefile
|
50
|
+
- lib/sasset.rb
|
51
|
+
- sasset.gemspec
|
52
|
+
has_rdoc: true
|
53
|
+
homepage: http://github.com/CapnKernul/sasset
|
54
|
+
licenses: []
|
55
|
+
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
hash: 3
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project: sasset
|
82
|
+
rubygems_version: 1.3.7
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: Asset hosts with SASS/SCSS
|
86
|
+
test_files: []
|
87
|
+
|