jekyll-postcss 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36556838c971c197ce6d535b28272d3c2b5e4628a5605da57fc14c99192caa64
4
- data.tar.gz: 9a02d2ef7378e18fcad7ccf23e7f089501efbbd2de9bca644c0692364d3b2e54
3
+ metadata.gz: d3a733de925db3bbf96ab3535777f4e73e4f24fb12232c0c70ee6d8379ff8dd6
4
+ data.tar.gz: 88225b5629853dece1241a3973304ca24dae4c85f9dd85bc114bd64765ccb6ff
5
5
  SHA512:
6
- metadata.gz: d790ab2d6ef1e048dfc80ed7480a6c11894d3366edbf04e08f3fa36badd0e65456a86be23258d579a6d3e5ca27ec404836932cd13fac1b6123bd4c7142aad460
7
- data.tar.gz: 30fac336ab8f81da3ae09731371f7332076ac7875cf94b755818a338bcebf7e4c710e5205dc8ba50648bfb953e5a8d73c3c77b052b89bcefb2b6589b8d25b65b
6
+ metadata.gz: e78c0ff9d352295e934ae7c69d392773e5333796755182f875e6a731111c0320f6636b4248b1aad6f4195cd3cda653bb03c941bc8bded2d78f728b7b0733b35b
7
+ data.tar.gz: 9dc039ca20a50b8a9ec29ba3933c11adea7ca1f9ae48247477db54e48fc2e593450ee3a35b402ac575800de7de1a49cf3efa3143163570634d9c8df2e0a3ef9e
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in jekyll-postcss.gemspec
4
6
  gemspec
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Jekyll PostCSS
2
2
  [![Build Status](https://travis-ci.com/mhanberg/jekyll-postcss.svg?branch=master)](https://travis-ci.com/mhanberg/jekyll-postcss)
3
+ [![Gem Version](https://badge.fury.io/rb/jekyll-postcss.svg)](https://badge.fury.io/rb/jekyll-postcss)
3
4
 
4
5
  A plugin to use PostCSS plugins like [Autoprefixer](https://github.com/postcss/autoprefixer) or [Tailwind CSS](https://github.com/tailwindcss/tailwindcss) with Jekyll.
5
6
 
@@ -39,6 +40,11 @@ module.exports {
39
40
 
40
41
  All files with the `.css` extension will now be processed by PostCSS.
41
42
 
43
+
44
+ ### Note
45
+
46
+ `jekyll-postcss` will cache your styles to avoid rebuilding when nothing has changed.
47
+
42
48
  ## Development
43
49
 
44
50
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -34,5 +34,5 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
34
34
  ENV["JEKYLL_VERSION"] ? "~> #{ENV["JEKYLL_VERSION"]}" : ">= 2.0"
35
35
  spec.add_development_dependency "rake", "~> 10.0"
36
36
  spec.add_development_dependency "rspec", "~> 3.0"
37
- spec.add_development_dependency "rubocop-jekyll", "~> 0.3.0"
37
+ spec.add_development_dependency "rubocop-jekyll", "~> 0.5.1"
38
38
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module PostCss
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "open3"
4
+ require "digest"
4
5
 
5
6
  module Jekyll
6
7
  module Converters
@@ -8,6 +9,13 @@ module Jekyll
8
9
  safe true
9
10
  priority :low
10
11
 
12
+ def initialize(config = {})
13
+ super
14
+
15
+ @raw_cache = nil
16
+ @converted_cache = nil
17
+ end
18
+
11
19
  def matches(ext)
12
20
  ext.casecmp(".css").zero?
13
21
  end
@@ -19,11 +27,19 @@ module Jekyll
19
27
  def convert(content)
20
28
  raise PostCssNotFoundError unless File.file?("./node_modules/.bin/postcss")
21
29
 
22
- compiled_css, status = Open3.capture2("./node_modules/.bin/postcss", :stdin_data => content)
30
+ raw_digest = Digest::MD5.hexdigest content
31
+ if @raw_cache != raw_digest
32
+ @raw_cache = raw_digest
33
+
34
+ compiled_css, status =
35
+ Open3.capture2("./node_modules/.bin/postcss", :stdin_data => content)
23
36
 
24
- raise PostCssRuntimeError unless status.success?
37
+ raise PostCssRuntimeError unless status.success?
25
38
 
26
- compiled_css
39
+ @converted_cache = compiled_css
40
+ else
41
+ @converted_cache
42
+ end
27
43
  end
28
44
  end
29
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-postcss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hanberg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-21 00:00:00.000000000 Z
11
+ date: 2019-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.3.0
75
+ version: 0.5.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.3.0
82
+ version: 0.5.1
83
83
  description: A PostCSS plugin for Jekyll.
84
84
  email:
85
85
  - mitch@mitchellhanberg.com
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.7.7
128
+ rubygems_version: 2.7.6
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: A PostCSS plugin for Jekyll.