jekyll-theme-assets 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-theme-assets.rb +14 -4
- data/lib/theme.rb +11 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 352fb7bbdf7b726c51e245e93fab2da3c0ce48bd
|
4
|
+
data.tar.gz: 437cdad5a0dd57ad721b85322d84f4aa411a34d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aee35aabcac549adcfb741f682e3855b967267d1e490a745175521b28d71e3afd7a84b03a98ddf9d47b04de74e8dc54f3c747e334eeeadef1eb17ac7d3f618a
|
7
|
+
data.tar.gz: 3479c1331328b82acf81b34a2ec2ea8a28a723102f0cccf551eb509609d1a809ecbf89d8c01d32352940f5c1433fe64a4e85bbea009f0ec00a9d7a5f87902206
|
data/lib/jekyll-theme-assets.rb
CHANGED
@@ -1,17 +1,27 @@
|
|
1
1
|
require 'jekyll-assets'
|
2
|
+
require 'theme'
|
2
3
|
|
3
4
|
# Jekyll Assets hook to discover and register assets of a gem-based Jekyll theme.
|
4
5
|
Jekyll::Assets::Hook.register :env, :init do
|
5
6
|
# Nothing to do if there is no theme
|
6
7
|
return unless jekyll.theme
|
7
|
-
#
|
8
|
-
|
8
|
+
# fetch from theme's "assets" folder
|
9
|
+
fetch_theme_assets(jekyll.theme.public_assets_path)
|
10
|
+
# fetch from theme's "_assets" folder
|
11
|
+
fetch_theme_assets(jekyll.theme.private_assets_path)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
9
15
|
|
16
|
+
# Simple helper to fetch assets from theme
|
17
|
+
def fetch_theme_assets(base_path)
|
18
|
+
# Base path is resolved to nil unless it does exists
|
19
|
+
return unless base_path
|
10
20
|
# Similar snippets could be found in Jekyll's code base (namely reader.rb)
|
11
|
-
dot_sources = Dir.chdir(
|
21
|
+
dot_sources = Dir.chdir(base_path) { filter_entries(Dir.entries("."), base_path) }
|
12
22
|
dot_sources.each do |source|
|
13
23
|
# TODO: Replace with the link to the original thread on Github on the subject...
|
14
|
-
jekyll.sprockets.append_path(File.join(
|
24
|
+
jekyll.sprockets.append_path(File.join(base_path, source))
|
15
25
|
end
|
16
26
|
end
|
17
27
|
|
data/lib/theme.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Lets extend base class with a few things to make our code
|
2
|
+
# less confusing (I hope that is the case LOL).
|
3
|
+
class Jekyll::Theme
|
4
|
+
# Our theme's public assets.
|
5
|
+
alias_method :public_assets_path, :assets_path
|
6
|
+
|
7
|
+
# Our theme's private assets.
|
8
|
+
def private_assets_path
|
9
|
+
path_for "_assets".freeze
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Tsurbeleu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll-assets
|
@@ -86,8 +86,8 @@ dependencies:
|
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '5.0'
|
89
|
-
description: A Jekyll plugin, that allows you to use
|
90
|
-
Jekyll theme.
|
89
|
+
description: A Jekyll plugin, that allows you to use private and public assets defined
|
90
|
+
in a gem-based Jekyll theme.
|
91
91
|
email:
|
92
92
|
- pavel.tsurbeleu@me.com
|
93
93
|
executables: []
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- README.md
|
100
100
|
- Rakefile
|
101
101
|
- lib/jekyll-theme-assets.rb
|
102
|
+
- lib/theme.rb
|
102
103
|
homepage: https://github.com/ptsurbeleu/jekyll-theme-assets/
|
103
104
|
licenses:
|
104
105
|
- MIT
|