css_splitter 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/css_splitter/engine.rb +2 -1
- data/lib/css_splitter/sprockets_engine.rb +16 -0
- data/lib/css_splitter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 859858b1596beb5feb01a1197720a5e463a1e1bc
|
4
|
+
data.tar.gz: ffd9aa6611ae252cffe6597f1ca9f6b4fb647c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 560f7bf19f745e86810515d8cd2c899f21d59943a8a5bbe253cf8d1ad7a59b3f6336c63fb2c04645fe44a5cf972a01f659660eb846116f27cbdb9aee4439ba15
|
7
|
+
data.tar.gz: f8accbbc62ed5faa8c973ea6e7745b2c53d99ff5b6a3ec79069108b85ff731f0f766287f6362ff66c3b18185a18b0e9833b773bad4c6cade69e5f20242e192c7
|
data/lib/css_splitter/engine.rb
CHANGED
@@ -12,7 +12,8 @@ module CssSplitter
|
|
12
12
|
|
13
13
|
initializer 'css_splitter.action_controller' do |app|
|
14
14
|
ActiveSupport.on_load :action_controller do
|
15
|
-
|
15
|
+
# Not all controllers use helpers (such as API based controllers)
|
16
|
+
helper CssSplitter::ApplicationHelper if respond_to?(:helper)
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -10,6 +10,22 @@ module CssSplitter
|
|
10
10
|
def prepare
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.call(input)
|
14
|
+
data_in = input[:data]
|
15
|
+
|
16
|
+
# Instantiate Sprockets::Context to pass along helper methods for Tilt
|
17
|
+
# processors
|
18
|
+
context = input[:environment].context_class.new(input)
|
19
|
+
|
20
|
+
# Pass the asset file contents as a block to the template engine,
|
21
|
+
# then get the results of the engine rendering
|
22
|
+
engine = self.new { data_in }
|
23
|
+
rendered_data = engine.render(context, {})
|
24
|
+
|
25
|
+
# Return the data and any metadata (ie file dependencies, etc)
|
26
|
+
context.metadata.merge(data: rendered_data.to_str)
|
27
|
+
end
|
28
|
+
|
13
29
|
def evaluate(scope, locals, &block)
|
14
30
|
# Evaluate the split if the asset is named with a trailing _split2, _split3, etc.
|
15
31
|
if scope.logical_path =~ /_split(\d+)$/
|
data/lib/css_splitter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: css_splitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Peters
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
210
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.
|
211
|
+
rubygems_version: 2.5.1
|
212
212
|
signing_key:
|
213
213
|
specification_version: 4
|
214
214
|
summary: CSS stylesheet splitter for Rails
|