middleman-critical 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/extension.rb +34 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b7dc7b5eeda984abb2f05662486138c39516bfdf
|
4
|
+
data.tar.gz: 80b6cd32c09bd79d3d09d568e9f836d3980c9beb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 54ac6e0e2d30d3fd0a2f54762c4e1737af733e879cf9acd8dfbf7e1a1a889dc06db9531df957eaa267f509e54b3ac15c1da26da4fb4b4386b54b47e2e0e888aa
|
7
|
+
data.tar.gz: 2116b5fc4e72a98ffb7f935ab2f141ebdb876a6e8371557273e97198664d28e77e82750b406f2a34e08c78200deccc7c4bf9a0721be5cb38bed68bc3427360e6
|
data/lib/extension.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'middleman-core'
|
2
|
+
|
3
|
+
class Critical < ::Middleman::Extension
|
4
|
+
|
5
|
+
option :binary, 'critical', 'The critical binary to use'
|
6
|
+
|
7
|
+
def initialize(app, options_hash={}, &block)
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def after_build(builder)
|
12
|
+
|
13
|
+
rootPath = app.root
|
14
|
+
buildDir = app.config[:build_dir]
|
15
|
+
htmlDir = buildDir + File::SEPARATOR + '**' + File::SEPARATOR + '*.html'
|
16
|
+
|
17
|
+
# cssDir = buildDir + File::SEPARATOR + app.config[:css_dir] + File::SEPARATOR + '**' + File::SEPARATOR + '*.css'
|
18
|
+
#cssDirs = []
|
19
|
+
|
20
|
+
#Dir.glob(cssDir) do |file|
|
21
|
+
# cssDirs.push(rootPath + File::SEPARATOR + file)
|
22
|
+
#end
|
23
|
+
|
24
|
+
Dir.glob(htmlDir) do |file|
|
25
|
+
assetPath = rootPath + File::SEPARATOR + file
|
26
|
+
file.slice! buildDir + File::SEPARATOR
|
27
|
+
%x(#{options.binary} #{assetPath} --base #{buildDir} --htmlTarget #{file} --extract --inline)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
Critical.register(:critical)
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-critical
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert Gründler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-30 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Middleman extension for critical path css generation. Requires the critical
|
14
|
+
binary
|
15
|
+
email: robert@dubture.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/extension.rb
|
21
|
+
homepage: https://github.com/pulse00/middleman-critical
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.4.5
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Middleman extension for critical path css generation
|
45
|
+
test_files: []
|