middleman-critical_css 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f5d2286d77d598ed18b02e5974e92cd46e92fce4
4
+ data.tar.gz: 77ad0a02666488f1831aa7d00c72263d40f20fb6
5
+ SHA512:
6
+ metadata.gz: ac9b1f4368d463c0fbf20c90e0d5fd07f8936e4a3daab335166b59b8b9681eec7199de5519c572802f9a1e46e3af70391a4f6adc257ddab672b6f2f11f184253
7
+ data.tar.gz: f196051caf53ffb51bb1393a3373bfdb18ce2c2e96bc0c23951ff3de3a92dbfc949177ed4f30cb570d07c7884115df85f01d5ab8045b7872bd540a66fe7c7db0
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ # Ignore bundler lock file
2
+ /Gemfile.lock
3
+
4
+ # Ignore pkg folder
5
+ /pkg
data/.rubocop.yml ADDED
@@ -0,0 +1,64 @@
1
+ AllCops:
2
+ Include:
3
+ - "**/Rakefile"
4
+ - "**/config.ru"
5
+ Exclude:
6
+ - "db/**/*"
7
+ - "config/**/*"
8
+ - "script/**/*"
9
+ - "bin/**/*"
10
+ - "vendor/**/*"
11
+ - "node_modules/**/*"
12
+ - "spec/factories.rb"
13
+ - "slack_bot/**/*"
14
+ TargetRubyVersion: 2.3
15
+
16
+ Metrics/LineLength:
17
+ Enabled: false
18
+
19
+ Style/AlignParameters:
20
+ EnforcedStyle: with_fixed_indentation
21
+
22
+ Style/ClassAndModuleChildren:
23
+ Enabled: false
24
+
25
+ Style/Documentation:
26
+ Enabled: false
27
+
28
+ Style/DotPosition:
29
+ EnforcedStyle: trailing
30
+
31
+ Style/IfUnlessModifier:
32
+ Enabled: false
33
+
34
+ Style/PredicateName:
35
+ NamePrefixBlacklist:
36
+ - is_
37
+ - have_
38
+
39
+ Style/StringLiterals:
40
+ EnforcedStyle: double_quotes
41
+
42
+ Style/NumericLiterals:
43
+ Enabled: false
44
+
45
+ Style/SingleLineBlockParams:
46
+ Enabled: false
47
+
48
+ Style/MultilineOperationIndentation:
49
+ EnforcedStyle: indented
50
+
51
+ Style/MultilineMethodCallIndentation:
52
+ EnforcedStyle: indented
53
+
54
+ Style/TrailingCommaInArguments:
55
+ EnforcedStyleForMultiline: comma
56
+
57
+ Style/TrailingCommaInLiteral:
58
+ EnforcedStyleForMultiline: comma
59
+
60
+ Style/FrozenStringLiteralComment:
61
+ Enabled: false
62
+
63
+ Style/MutableConstant:
64
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Subvisual
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,30 @@
1
+ ## Middleman Critical CSS
2
+
3
+ Integration of [critical](https://github.com/addyosmani/critical) into [Middleman](https://middlemanapp.com/)'s pipeline.
4
+
5
+ ### Dependencies
6
+
7
+ The `critical` binary must be available on the system.
8
+
9
+
10
+ ### Usage
11
+
12
+
13
+ ```
14
+ # Gemfile
15
+
16
+ gem "middleman-critical-css", "~> 0.0.1"
17
+
18
+ ```
19
+
20
+ `bundle install`
21
+
22
+ ```ruby
23
+ # config.rb
24
+
25
+ configure :build do
26
+ activate :critical,
27
+ :binary => "node_modules/.bin/critical",
28
+ :minify => true
29
+
30
+ ```
@@ -0,0 +1,35 @@
1
+ require "middleman-core"
2
+
3
+ module Middleman
4
+ class CriticalCssExtension < Extension
5
+ option :binary, "node_modules/.bin/critical", "The criticalCSS binary to use"
6
+ option :minify, true, "Minify inlined CSS"
7
+
8
+ def after_build
9
+ Dir.glob(html_files) do |file|
10
+ asset_path = File.join(app.root, file)
11
+
12
+ file.slice! app.config[:build_dir] + File::SEPARATOR
13
+
14
+ `#{cmd(asset_path, file)}`
15
+ end
16
+ end
17
+
18
+ def html_files
19
+ File.join(app.config[:build_dir], "**", "*.html")
20
+ end
21
+
22
+ def cmd(asset_path, file)
23
+ args = [
24
+ options.binary,
25
+ asset_path,
26
+ "--base", app.config[:build_dir],
27
+ "--htmlTarget", file,
28
+ "--extract", "--inline"
29
+ ]
30
+ args << "--minify" if options.minify
31
+
32
+ args.join(" ")
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,6 @@
1
+ require "middleman-core"
2
+
3
+ ::Middleman::Extensions.register(:critical_css) do
4
+ require "middleman-critical_css/extension"
5
+ ::Middleman::CriticalCssExtension
6
+ end
@@ -0,0 +1 @@
1
+ require "middleman-critical_css"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "middleman-critical_css"
7
+ spec.version = "0.0.1"
8
+ spec.authors = ["Miguel Palhas"]
9
+ spec.email = ["miguel@subvisual.co"]
10
+
11
+ spec.summary = %q{criticalCSS integrated in middleman's pipeline}
12
+ spec.description = %q{criticalCSS integrated in middleman's pipeline}
13
+ spec.homepage = "https://github.com/subvisual/middleman-critical_css"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.13"
24
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-critical_css
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Miguel Palhas
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-30 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.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ description: criticalCSS integrated in middleman's pipeline
28
+ email:
29
+ - miguel@subvisual.co
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - ".rubocop.yml"
36
+ - Gemfile
37
+ - LICENSE
38
+ - README.md
39
+ - lib/middleman-critical_css.rb
40
+ - lib/middleman-critical_css/extension.rb
41
+ - lib/middleman-extension.rb
42
+ - middleman-critical_css.gemspec
43
+ homepage: https://github.com/subvisual/middleman-critical_css
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.5.2
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: criticalCSS integrated in middleman's pipeline
67
+ test_files: []