jekyll-postcss-v2 1.0.1 → 1.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
  SHA256:
3
- metadata.gz: 5bba2a3b9465f900eb7eca43bb91cf7260de96dfc4fef8c206fc77464962cb6a
4
- data.tar.gz: d8799804da82a9d4ad9e8fc1ed098af675a4d67d00e2946ebc7d23ab9c75a9b0
3
+ metadata.gz: 355465f0a7ff03775c701327324d28f839e9eb999ab0521db78e5a8b91c3c734
4
+ data.tar.gz: 046316cee00e8d4e1643f14b866a9ab173e518ab960d25ee27ab4cba7fae03c4
5
5
  SHA512:
6
- metadata.gz: 0cb379319cab02d45abc17e6bb056b6253899c7cf72e8f430dff071dade71678ad9d9f5b4c71d61b409c2c3efeee423ffdb5684c28566a0fa15efcdccdc97107
7
- data.tar.gz: 98e5ff3f4db6919263e78d798e72c08d6a8b23ba05378ceaabcd6aeb1a07a000b9a5f863208cf23d6232a56de826c8ffc95ae38389be10397c93dacabfb0ae3b
6
+ metadata.gz: 97ed7678e2fb27bc61432d5c75ccaa639d344d1ca1242e9a1e80334b841d52d1fe97101bf0e6d3ad9ba880a3386d830653983b84cf3faf6e5f7be79d19f057ee
7
+ data.tar.gz: d661c419ab3fd622ed8eb4cae573448bd90858913b3ea37e64e2c54bc655e2f832e74eb75f5fbc240843b13891e1a85795f7cbb46297cdbc78455f2bbac63b32
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
@@ -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
@@ -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,8 +16,8 @@ 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."
@@ -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.1"
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.1
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-13 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,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".rubocop.yml"
92
+ - CHANGELOG.md
92
93
  - Gemfile
93
94
  - README.md
94
95
  - Rakefile
@@ -102,7 +103,7 @@ licenses:
102
103
  metadata:
103
104
  homepage_uri: https://github.com/bglw/jekyll-postcss-v2
104
105
  source_code_uri: https://github.com/bglw/jekyll-postcss-v2
105
- post_install_message:
106
+ post_install_message:
106
107
  rdoc_options: []
107
108
  require_paths:
108
109
  - lib
@@ -117,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.0.3
121
- signing_key:
121
+ rubygems_version: 3.1.6
122
+ signing_key:
122
123
  specification_version: 4
123
124
  summary: Straight up PostCSS for Jekyll.
124
125
  test_files: []