middleman-critical 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7dc7b5eeda984abb2f05662486138c39516bfdf
4
- data.tar.gz: 80b6cd32c09bd79d3d09d568e9f836d3980c9beb
3
+ metadata.gz: f13c35dbe01bfea9d9a9dbe434958a16a732e66b
4
+ data.tar.gz: ae733f7c07cff862efb8feb829c0cd9eee662497
5
5
  SHA512:
6
- metadata.gz: 54ac6e0e2d30d3fd0a2f54762c4e1737af733e879cf9acd8dfbf7e1a1a889dc06db9531df957eaa267f509e54b3ac15c1da26da4fb4b4386b54b47e2e0e888aa
7
- data.tar.gz: 2116b5fc4e72a98ffb7f935ab2f141ebdb876a6e8371557273e97198664d28e77e82750b406f2a34e08c78200deccc7c4bf9a0721be5cb38bed68bc3427360e6
6
+ metadata.gz: 3787a1ec8f6a692f8ecd71c5c28d8669494ee94c11d9c5d998aa71e7bad7240fa175f81119b64926355812f744651095e724030b7b313d40653b11d424fcab0a
7
+ data.tar.gz: a1df35359e49569105d193bf0cb5a2a70a6a0e46f227725622e49299917d8049635c5337fbd4a549eea8f738a8205378a2edc33a6a820b3fdaae584fbd27a3a2
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ # Ignore bundler lock file
2
+ /Gemfile.lock
3
+
4
+ # Ignore pkg folder
5
+ /pkg
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # If you do not have OpenSSL installed, update
2
+ # the following line to use "http://" instead
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in middleman-critical.gemspec
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Robert Gründler
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ ## Middleman-Critical
2
+
3
+ [Middleman](https://middlemanapp.com/) extension to generate critical-path css using [critical](https://github.com/addyosmani/critical)
4
+
5
+ ### Dependencies
6
+
7
+ The `critical` binary must be available on the system.
8
+
9
+
10
+ ### Usage
11
+
12
+
13
+ ```ruby
14
+ # config.rb
15
+
16
+ activate :critical, :binary => '/usr/local/bin/critical' # binary defaults to 'critical'
17
+
18
+ ```
@@ -0,0 +1,36 @@
1
+ require 'middleman-core'
2
+
3
+ module Middleman
4
+
5
+ class CriticalExtension < Extension
6
+
7
+ option :binary, 'critical', 'The critical binary to use'
8
+
9
+ def initialize(app, options_hash={}, &block)
10
+ super
11
+ end
12
+
13
+ def after_build(builder)
14
+
15
+ rootPath = app.root
16
+ buildDir = app.config[:build_dir]
17
+ htmlDir = buildDir + File::SEPARATOR + '**' + File::SEPARATOR + '*.html'
18
+
19
+ # cssDir = buildDir + File::SEPARATOR + app.config[:css_dir] + File::SEPARATOR + '**' + File::SEPARATOR + '*.css'
20
+ #cssDirs = []
21
+
22
+ #Dir.glob(cssDir) do |file|
23
+ # cssDirs.push(rootPath + File::SEPARATOR + file)
24
+ #end
25
+
26
+ Dir.glob(htmlDir) do |file|
27
+ assetPath = rootPath + File::SEPARATOR + file
28
+ file.slice! buildDir + File::SEPARATOR
29
+ %x(#{options.binary} #{assetPath} --base #{buildDir} --htmlTarget #{file} --extract --inline)
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,6 @@
1
+ require "middleman-core"
2
+
3
+ ::Middleman::Extensions.register(:critical) do
4
+ require "middleman-critical/extension"
5
+ ::Middleman::CriticalExtension
6
+ end
@@ -0,0 +1 @@
1
+ require "middleman-critical"
@@ -0,0 +1,14 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.name = 'middleman-critical'
3
+ gem.version = '0.0.2'
4
+ gem.date = '2015-05-30'
5
+ gem.summary = "Middleman extension for critical path css generation"
6
+ gem.description = "Middleman extension for critical path css generation. Requires the critical binary"
7
+ gem.authors = ["Robert Gründler"]
8
+ gem.email = 'robert@dubture.com'
9
+ gem.files = `git ls-files`.split($\)
10
+ gem.homepage = 'https://github.com/pulse00/middleman-critical'
11
+ gem.license = 'MIT'
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.require_paths = ["lib"]
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-critical
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Gründler
@@ -17,7 +17,14 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - lib/extension.rb
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - LICENSE
23
+ - README.md
24
+ - lib/middleman-critical.rb
25
+ - lib/middleman-critical/extension.rb
26
+ - lib/middleman-extension.rb
27
+ - middleman-critical.gemspec
21
28
  homepage: https://github.com/pulse00/middleman-critical
22
29
  licenses:
23
30
  - MIT
data/lib/extension.rb DELETED
@@ -1,34 +0,0 @@
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)