middleman4-sprockets3-sassc 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +22 -0
- data/lib/middleman4-sprockets3-sassc.rb +6 -0
- data/lib/middleman4-sprockets3-sassc/extension.rb +12 -0
- data/lib/middleman4-sprockets3-sassc/monkey-patches.rb +60 -0
- data/lib/middleman4-sprockets3-sassc/version.rb +7 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman4-sprockets3-sassc.gemspec +27 -0
- metadata +156 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4bd1716b0ed39f89752748b54891493341ab6bc1
|
4
|
+
data.tar.gz: dbc4b26bb53d49e03a8dc45cdd7d3a4281a96f72
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98ee6e4ce42a4576d9a595020e6c4c6b5b164976595dc992c463c43f9c81b874a91dde32f59cde2fa133e79ac6130cbd8e645beab4895206263838c8908cf0f9
|
7
|
+
data.tar.gz: 05eeed716de2765860a7321bf86df86ba111601c7210ff2e9f9049974cbf65bdcb97c809470b5ff1f50e7931e97ca683fb19c98433ad5d5e51582180ec096f48
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Brad Chen
|
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,22 @@
|
|
1
|
+
# SassC for Middleman 4 and Sprockets 3
|
2
|
+
|
3
|
+
This gem lets you use SassC with Middleman 4 and Sprockets 3 by monkey patching classes. (Middleman 4 without Sprockets
|
4
|
+
or with Sprockets 4 will support SassC out of box.)
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
In `Gemfile`:
|
9
|
+
```ruby
|
10
|
+
gem 'middleman4-sprockets3-sassc', '~> 0.0.4'
|
11
|
+
```
|
12
|
+
|
13
|
+
In `config.rb`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
activate :sprockets3_sassc
|
17
|
+
```
|
18
|
+
|
19
|
+
## License
|
20
|
+
|
21
|
+
The gem is available as open source under the terms of the
|
22
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module ::Sprockets::SassC
|
2
|
+
class SassProcessor < ::Sprockets::SassProcessor
|
3
|
+
def call(input)
|
4
|
+
context = input[:environment].context_class.new(input)
|
5
|
+
options = {
|
6
|
+
filename: input[:filename],
|
7
|
+
syntax: self.class.syntax,
|
8
|
+
load_paths: input[:environment].paths,
|
9
|
+
importer: ::SassC::Rails::Importer,
|
10
|
+
sprockets: {
|
11
|
+
context: context,
|
12
|
+
environment: input[:environment],
|
13
|
+
dependencies: context.metadata[:dependency_paths]
|
14
|
+
}
|
15
|
+
}
|
16
|
+
engine = ::SassC::Engine.new(input[:data], options)
|
17
|
+
|
18
|
+
css = Sprockets::Utils.module_include(::SassC::Script::Functions, @functions) do
|
19
|
+
engine.render
|
20
|
+
end
|
21
|
+
|
22
|
+
context.metadata.merge(data: css)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class ScssProcessor < SassProcessor
|
27
|
+
def self.syntax
|
28
|
+
:scss
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class ::Middleman::Sprockets::Extension
|
34
|
+
private
|
35
|
+
def use_sassc_if_available
|
36
|
+
if try_require('sassc-rails') && defined?(::SassC::Rails)
|
37
|
+
environment.register_engine '.sass', ::Sprockets::SassC::SassProcessor, mime_type: 'text/css',
|
38
|
+
silence_deprecation: true
|
39
|
+
environment.register_engine '.scss', ::Sprockets::SassC::ScssProcessor, mime_type: 'text/css',
|
40
|
+
silence_deprecation: true
|
41
|
+
logger.info '== Sprockets will render css with SassC'
|
42
|
+
elsif try_require('sprockets/sassc_processor') && defined?(::SassC)
|
43
|
+
environment.register_transformer 'text/sass', 'text/css', ::Sprockets::SasscProcessor.new
|
44
|
+
environment.register_transformer 'text/scss', 'text/css', ::Sprockets::ScsscProcessor.new
|
45
|
+
logger.info '== Sprockets will render css with SassC'
|
46
|
+
else
|
47
|
+
logger.info "== Sprockets will render css with ruby sass\n" \
|
48
|
+
' consider using Sprockets 4.x to render with SassC'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def try_require script
|
53
|
+
begin
|
54
|
+
require script
|
55
|
+
true
|
56
|
+
rescue LoadError
|
57
|
+
false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'middleman4-sprockets3-sassc'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'middleman4-sprockets3-sassc/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'middleman4-sprockets3-sassc'
|
8
|
+
spec.version = Middleman4::Sprockets3::SassC::VERSION
|
9
|
+
spec.authors = ['Brad Chen']
|
10
|
+
spec.email = ['brad.chen@70ms.com']
|
11
|
+
spec.homepage = 'https://github.com/70mainstreet/middleman3-sassc'
|
12
|
+
|
13
|
+
spec.summary = %q{Use SassC with Middleman 4 and Sprockets 3.}
|
14
|
+
spec.description = %q{This gem lets you use SassC with Middleman 4 and Sprockets 3.}
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
|
+
spec.add_runtime_dependency 'sassc', ['>= 1.7', '< 2']
|
23
|
+
spec.add_runtime_dependency 'sassc-rails', ['>= 1.1', '< 2']
|
24
|
+
spec.add_runtime_dependency 'middleman-core', '~> 4'
|
25
|
+
spec.add_runtime_dependency 'middleman-sprockets', ['>= 4.0.0', '< 5']
|
26
|
+
spec.add_runtime_dependency 'sprockets', '~> 3'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman4-sprockets3-sassc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brad Chen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sassc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '2'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.7'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sassc-rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.1'
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '2'
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.1'
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '2'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: middleman-core
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '4'
|
74
|
+
type: :runtime
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '4'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: middleman-sprockets
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 4.0.0
|
88
|
+
- - "<"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '5'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 4.0.0
|
98
|
+
- - "<"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '5'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: sprockets
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '3'
|
108
|
+
type: :runtime
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '3'
|
115
|
+
description: This gem lets you use SassC with Middleman 4 and Sprockets 3.
|
116
|
+
email:
|
117
|
+
- brad.chen@70ms.com
|
118
|
+
executables: []
|
119
|
+
extensions: []
|
120
|
+
extra_rdoc_files: []
|
121
|
+
files:
|
122
|
+
- ".gitignore"
|
123
|
+
- Gemfile
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- lib/middleman4-sprockets3-sassc.rb
|
127
|
+
- lib/middleman4-sprockets3-sassc/extension.rb
|
128
|
+
- lib/middleman4-sprockets3-sassc/monkey-patches.rb
|
129
|
+
- lib/middleman4-sprockets3-sassc/version.rb
|
130
|
+
- lib/middleman_extension.rb
|
131
|
+
- middleman4-sprockets3-sassc.gemspec
|
132
|
+
homepage: https://github.com/70mainstreet/middleman3-sassc
|
133
|
+
licenses:
|
134
|
+
- MIT
|
135
|
+
metadata: {}
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 2.5.1
|
153
|
+
signing_key:
|
154
|
+
specification_version: 4
|
155
|
+
summary: Use SassC with Middleman 4 and Sprockets 3.
|
156
|
+
test_files: []
|