jekyll-postcss-v2 1.0.0 → 1.0.2

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: ba330d199aa1671ac43e2cfe7d61072d6d73b6d5e3280d1051bf75113948440c
4
- data.tar.gz: 7acf137ddb7e194a625ff6b2a8ec09afb4a1f774fa240d5c4a36e3347d7dddbb
3
+ metadata.gz: 355465f0a7ff03775c701327324d28f839e9eb999ab0521db78e5a8b91c3c734
4
+ data.tar.gz: 046316cee00e8d4e1643f14b866a9ab173e518ab960d25ee27ab4cba7fae03c4
5
5
  SHA512:
6
- metadata.gz: 3682a8afa70f816943a0ee63e04cdb25276cfe748699e17af9d5d2d5bda639adb4e17255fef5fdd931bbde3d8f6ef21e637deb786d34072fa0517e451d531dc4
7
- data.tar.gz: cbfff3eedc371741b44bfa6ea7eabdbac94ab8c72c5e98804f214c273efc849f61183989b705b639a4547ec2662e8f82cc8c0aec3d31c9e9e82fe1d93b3b17f4
6
+ metadata.gz: 97ed7678e2fb27bc61432d5c75ccaa639d344d1ca1242e9a1e80334b841d52d1fe97101bf0e6d3ad9ba880a3386d830653983b84cf3faf6e5f7be79d19f057ee
7
+ data.tar.gz: d661c419ab3fd622ed8eb4cae573448bd90858913b3ea37e64e2c54bc655e2f832e74eb75f5fbc240843b13891e1a85795f7cbb46297cdbc78455f2bbac63b32
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  .jekyll-cache
2
2
  _site
3
- node_modules
3
+ node_modules
4
+ pkg
5
+ Gemfile.lock
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## 1.0.2
4
+
5
+ (PR #4): Added an option to specify a postcss location in your _config.yml file:
6
+
7
+ ```yml
8
+ postcss:
9
+ script: node_modules/.bin/postcss
10
+ config: postcss.config.js
11
+ ```
data/README.md CHANGED
@@ -3,11 +3,11 @@ A revamp of [jekyll-postcss](https://github.com/mhanberg/jekyll-postcss) that us
3
3
 
4
4
  ## Table of contents
5
5
 
6
- - [Installation](README.md#installation)
7
- - [Usage](README.md#usage)
8
- - [Why v2?](README.md#why-v2)
9
- - [Why not?](README.md#why-not)
10
- - [TODO](README.md#todo)
6
+ - [Installation](#installation)
7
+ - [Usage](#usage)
8
+ - [Why v2?](#why-v2)
9
+ - [Why not?](#why-not)
10
+ - [TODO](#todo)
11
11
 
12
12
  ## Installation
13
13
 
@@ -27,13 +27,91 @@ plugins:
27
27
 
28
28
  _In your jekyll source directory:_
29
29
  ```bash
30
- npm i -D postcss postcss-cli
30
+ npm i postcss postcss-cli
31
31
  ```
32
32
 
33
+ Also install any postcss plugins you wish to use. For example, [fluidvars](https://github.com/bglw/postcss-fluidvars), [autoprefixer](https://github.com/postcss/autoprefixer), [cssnano](https://cssnano.co/) etc.
34
+
33
35
  ## Usage
34
36
 
35
37
  Configure your `postcss.config.js` file in your jekyll source directory.
36
38
 
39
+ ## Configuration
40
+
41
+ This plugin will try and locate Postcss automatically. If this fails, you can specify locations in the `_config.yml` file of your site:
42
+ ```yml
43
+ postcss:
44
+ script: node_modules/.bin/postcss
45
+ config: postcss.config.js
46
+ ```
47
+
48
+ ## Deployment
49
+
50
+ No extra configuration is required for deployment on platforms like [CloudCannon](https://cloudcannon.com/) which support custom plugins.
51
+
52
+ Please note that this plugin isn't supported by [GitHub Pages](https://pages.github.com/).
53
+ To host on GitHub Pages and use this plugin, use GitHub Actions to build and deploy your website.
54
+
55
+ To do that, you need to specify a workflow inside the `.github/workflows` of your repository for your build process. This could look like the following:
56
+
57
+ ```yml
58
+ name: Jekyll Deploy
59
+
60
+ on:
61
+ schedule:
62
+ # run daily at 05:30
63
+ - cron: '30 5 * * *'
64
+ push:
65
+ branches:
66
+ - main
67
+ paths-ignore:
68
+ - 'Gemfile'
69
+ - 'README.md'
70
+ - 'LICENSE.md'
71
+
72
+ # Build site using jekyll
73
+ jobs:
74
+ jekyll:
75
+ runs-on: ubuntu-latest
76
+ steps:
77
+ # checkout code
78
+ - uses: actions/checkout@v2
79
+ # Use ruby/setup-ruby to shorten build times
80
+ # https://github.com/ruby/setup-ruby
81
+ - uses: ruby/setup-ruby@v1
82
+ with:
83
+ ruby-version: 2.7 # Not needed with a .ruby-version file
84
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
85
+ # Install Node as this is needed for PostCSS
86
+ - name: Setup Node
87
+ uses: actions/setup-node@v2
88
+ with:
89
+ node-version: '14'
90
+ # Install PostCSS plugins (from your package.json)
91
+ - run: npm install
92
+ - name: Build site
93
+ # use jekyll-action-ts to build
94
+ # https://github.com/limjh16/jekyll-action-ts
95
+ uses: limjh16/jekyll-action-ts@v2
96
+ with:
97
+ enable_cache: true
98
+ # custom_opts: '--verbose --trace' #'--drafts --future'
99
+ ### If you need to specify any Jekyll build options, enable the above input
100
+ ### Flags accepted can be found here https://jekyllrb.com/docs/configuration/options/#build-command-options
101
+ # use actions-gh-pages to deploy
102
+ # https://github.com/peaceiris/actions-gh-pages
103
+ - name: Deploy
104
+ uses: peaceiris/actions-gh-pages@v3
105
+ with:
106
+ # GITHUB_TOKEN secret is set up automatically
107
+ github_token: ${{ secrets.GITHUB_TOKEN }}
108
+ publish_dir: ./_site
109
+ ```
110
+
111
+ See:
112
+
113
+ - https://github.com/limjh16/jekyll-action-ts/ for more details about the GitHub Action compiling your site.
114
+
37
115
  ## Why v2?
38
116
  - Better logging to help catch when things aren't running
39
117
  - Processes the output file on disk, skipping the need to parse Sass
@@ -55,4 +133,4 @@ Configure your `postcss.config.js` file in your jekyll source directory.
55
133
  - Investigate what needs to be done around the sourcemap
56
134
  - More logging.
57
135
  - Before/after filesizes
58
- - Timings
136
+ - Timings
@@ -4,9 +4,9 @@ require "pathname"
4
4
 
5
5
  module PostCssV2
6
6
  class Engine
7
- def initialize(source)
8
- @script = Pathname.new(source + "/node_modules/.bin/postcss")
9
- unless @script.exist?
7
+ def initialize(source, options = {})
8
+ @script = File.expand_path(options[:script] || 'node_modules/.bin/postcss', source)
9
+ unless File.exist?(@script)
10
10
  Jekyll.logger.error "PostCSS v2:",
11
11
  "PostCSS not found.
12
12
  Make sure postcss and postcss-cli
@@ -16,20 +16,20 @@ module PostCssV2
16
16
  exit 1
17
17
  end
18
18
 
19
- config = Pathname.new(source + "/postcss.config.js")
20
- unless config.exist?
19
+ @config = File.expand_path(options[:config] || 'postcss.config.js', source)
20
+ unless File.exist?(@config)
21
21
  Jekyll.logger.error "PostCSS v2:",
22
22
  "postcss.config.js not found.
23
23
  Make sure it exists in your Jekyll source."
24
24
  Jekyll.logger.error "PostCSS v2:",
25
- "Couldn't find #{config}"
25
+ "Couldn't find #{@config}"
26
26
  exit 1
27
27
  end
28
28
  end
29
29
 
30
30
  def process(page)
31
31
  file_path = Pathname.new(page.site.dest + page.url)
32
- postcss_command = `#{@script} #{file_path} -r`
32
+ postcss_command = `#{@script} #{file_path} -r --config #{@config}`
33
33
  Jekyll.logger.info "PostCSS v2:",
34
34
  "Rewrote #{page.url} #{postcss_command}"
35
35
  end
@@ -38,7 +38,10 @@ end
38
38
 
39
39
  Jekyll::Hooks.register :pages, :post_write do |page|
40
40
  if %r!\.css$! =~ page.url
41
- engine = PostCssV2::Engine.new(page.site.source)
41
+ engine = PostCssV2::Engine.new(page.site.source, {
42
+ script: page.site.config.dig('postcss', 'script'),
43
+ config: page.site.config.dig('postcss', 'config'),
44
+ })
42
45
  engine.process(page)
43
46
  end
44
47
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module PostCssV2
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-postcss-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liam Bigelow
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-12 00:00:00.000000000 Z
11
+ date: 2023-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,8 +89,8 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".rubocop.yml"
92
+ - CHANGELOG.md
92
93
  - Gemfile
93
- - Gemfile.lock
94
94
  - README.md
95
95
  - Rakefile
96
96
  - jekyll-postcss-v2.gemspec
@@ -103,7 +103,7 @@ licenses:
103
103
  metadata:
104
104
  homepage_uri: https://github.com/bglw/jekyll-postcss-v2
105
105
  source_code_uri: https://github.com/bglw/jekyll-postcss-v2
106
- post_install_message:
106
+ post_install_message:
107
107
  rdoc_options: []
108
108
  require_paths:
109
109
  - lib
@@ -118,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.0.3
122
- signing_key:
121
+ rubygems_version: 3.1.6
122
+ signing_key:
123
123
  specification_version: 4
124
124
  summary: Straight up PostCSS for Jekyll.
125
125
  test_files: []
data/Gemfile.lock DELETED
@@ -1,110 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- jekyll-postcss-v2 (1.0.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- addressable (2.7.0)
10
- public_suffix (>= 2.0.2, < 5.0)
11
- ast (2.4.2)
12
- colorator (1.1.0)
13
- concurrent-ruby (1.1.9)
14
- diff-lcs (1.4.4)
15
- em-websocket (0.5.2)
16
- eventmachine (>= 0.12.9)
17
- http_parser.rb (~> 0.6.0)
18
- eventmachine (1.2.7)
19
- ffi (1.15.1)
20
- forwardable-extended (2.6.0)
21
- http_parser.rb (0.6.0)
22
- i18n (1.8.10)
23
- concurrent-ruby (~> 1.0)
24
- jaro_winkler (1.5.4)
25
- jekyll (4.2.0)
26
- addressable (~> 2.4)
27
- colorator (~> 1.0)
28
- em-websocket (~> 0.5)
29
- i18n (~> 1.0)
30
- jekyll-sass-converter (~> 2.0)
31
- jekyll-watch (~> 2.0)
32
- kramdown (~> 2.3)
33
- kramdown-parser-gfm (~> 1.0)
34
- liquid (~> 4.0)
35
- mercenary (~> 0.4.0)
36
- pathutil (~> 0.9)
37
- rouge (~> 3.0)
38
- safe_yaml (~> 1.0)
39
- terminal-table (~> 2.0)
40
- jekyll-sass-converter (2.1.0)
41
- sassc (> 2.0.1, < 3.0)
42
- jekyll-watch (2.2.1)
43
- listen (~> 3.0)
44
- kramdown (2.3.1)
45
- rexml
46
- kramdown-parser-gfm (1.1.0)
47
- kramdown (~> 2.0)
48
- liquid (4.0.3)
49
- listen (3.5.1)
50
- rb-fsevent (~> 0.10, >= 0.10.3)
51
- rb-inotify (~> 0.9, >= 0.9.10)
52
- mercenary (0.4.0)
53
- parallel (1.20.1)
54
- parser (3.0.1.1)
55
- ast (~> 2.4.1)
56
- pathutil (0.16.2)
57
- forwardable-extended (~> 2.6)
58
- powerpack (0.1.3)
59
- public_suffix (4.0.6)
60
- rainbow (3.0.0)
61
- rake (13.0.3)
62
- rb-fsevent (0.11.0)
63
- rb-inotify (0.10.1)
64
- ffi (~> 1.0)
65
- rexml (3.2.5)
66
- rouge (3.26.0)
67
- rspec (3.10.0)
68
- rspec-core (~> 3.10.0)
69
- rspec-expectations (~> 3.10.0)
70
- rspec-mocks (~> 3.10.0)
71
- rspec-core (3.10.1)
72
- rspec-support (~> 3.10.0)
73
- rspec-expectations (3.10.1)
74
- diff-lcs (>= 1.2.0, < 2.0)
75
- rspec-support (~> 3.10.0)
76
- rspec-mocks (3.10.2)
77
- diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (~> 3.10.0)
79
- rspec-support (3.10.2)
80
- rubocop (0.62.0)
81
- jaro_winkler (~> 1.5.1)
82
- parallel (~> 1.10)
83
- parser (>= 2.5, != 2.5.1.1)
84
- powerpack (~> 0.1)
85
- rainbow (>= 2.2.2, < 4.0)
86
- ruby-progressbar (~> 1.7)
87
- unicode-display_width (~> 1.4.0)
88
- rubocop-jekyll (0.5.1)
89
- rubocop (>= 0.57.2, < 0.63.0)
90
- ruby-progressbar (1.11.0)
91
- safe_yaml (1.0.5)
92
- sassc (2.4.0)
93
- ffi (~> 1.9)
94
- terminal-table (2.0.0)
95
- unicode-display_width (~> 1.1, >= 1.1.1)
96
- unicode-display_width (1.4.1)
97
-
98
- PLATFORMS
99
- ruby
100
-
101
- DEPENDENCIES
102
- bundler (~> 2.1)
103
- jekyll (>= 3.0)
104
- jekyll-postcss-v2!
105
- rake (>= 12.3.3)
106
- rspec (~> 3.0)
107
- rubocop-jekyll (~> 0.5.1)
108
-
109
- BUNDLED WITH
110
- 2.1.4