nanoc-webpack.rb 0.4.5 → 0.5.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 +4 -4
- data/.bundle/config +2 -0
- data/.gitignore +1 -0
- data/Gemfile +0 -1
- data/README.md +29 -0
- data/lib/nanoc/webpack/filter.rb +17 -5
- data/lib/nanoc/webpack/version.rb +1 -1
- data/nanoc-webpack.rb.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb4f774661ab8864e181668d80bcbcbc79bdd4b45ec746ebc29fae83828691b2
|
4
|
+
data.tar.gz: 05adf92c987389b5b1e6fa418b2e83c5d5b1ac7e93c9ddfd12b300ad3421be24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 343e55d3a8557216618eaf5c9956daa9dfc9c08c4a11d54fca4575d021e9ebcff30c11acac5e5602a676abd05e9e50a799f395b60f3b0431f925c6731d12870b
|
7
|
+
data.tar.gz: abbeaf8c6c482dbe8ccab176970b032d7fecf72d04a8e2e46e3145a1b09bd6a7b5e7a6bccaec8bb62c0e14955dc65105ee324f3307e30e351d15394bc2a2846b
|
data/.bundle/config
ADDED
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -56,6 +56,22 @@ compile "/js/ReactApp.jsx" do
|
|
56
56
|
end
|
57
57
|
```
|
58
58
|
|
59
|
+
__Option: "args"__
|
60
|
+
|
61
|
+
The `args` option can be used to forward command-line options directly
|
62
|
+
to the webpack executable. See `$ webpack build --help` for the list of
|
63
|
+
options that are available:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
# Rules
|
67
|
+
require "nanoc-webpack"
|
68
|
+
compile "/js/ReactApp.jsx" do
|
69
|
+
filter :webpack, args: {"--no-stats" => true}
|
70
|
+
write("/js/app.js")
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
|
59
75
|
## Requirements
|
60
76
|
|
61
77
|
nanoc-webpack.rb assumes that:
|
@@ -72,12 +88,25 @@ nanoc-webpack.rb assumes that:
|
|
72
88
|
|
73
89
|
## <a id='install'>Install</a>
|
74
90
|
|
91
|
+
**Git**
|
92
|
+
|
75
93
|
nanoc-webpack.rb is distributed as a RubyGem through its git repositories. <br>
|
76
94
|
[GitHub](https://github.com/0x1eef/nanoc-webpack.rb),
|
77
95
|
and
|
78
96
|
[GitLab](https://gitlab.com/0x1eef/nanoc-webpack.rb)
|
79
97
|
are available as sources.
|
80
98
|
|
99
|
+
```ruby
|
100
|
+
# Gemfile
|
101
|
+
gem "nanoc-webpack.rb", github: "0x1eef/nanoc-webpack.rb", tag: "v0.5.0"
|
102
|
+
```
|
103
|
+
|
104
|
+
**Rubygems.org**
|
105
|
+
|
106
|
+
nanoc-webpack.rb can also be installed via rubygems.org.
|
107
|
+
|
108
|
+
gem install nanoc-webpack.rb
|
109
|
+
|
81
110
|
## License
|
82
111
|
|
83
112
|
[BSD Zero Clause](https://choosealicense.com/licenses/0bsd/).
|
data/lib/nanoc/webpack/filter.rb
CHANGED
@@ -14,17 +14,19 @@ class Nanoc::Webpack::Filter < Nanoc::Filter
|
|
14
14
|
def run(content, options = {})
|
15
15
|
depend_on dependable(paths: options[:depend_on], reject: options[:reject])
|
16
16
|
.map { items[_1] }
|
17
|
-
webpack(
|
17
|
+
webpack temporary_file_for(content),
|
18
|
+
args: options[:args]
|
18
19
|
end
|
19
20
|
|
20
21
|
private
|
21
22
|
|
22
|
-
def webpack(file)
|
23
|
+
def webpack(file, args: [])
|
23
24
|
system "node",
|
24
25
|
"./node_modules/webpack/bin/webpack.js",
|
25
26
|
"--entry", File.join(Dir.getwd, item.attributes[:content_filename]),
|
26
27
|
"--output-path", File.dirname(file.path),
|
27
|
-
"--output-filename", File.basename(file.path)
|
28
|
+
"--output-filename", File.basename(file.path),
|
29
|
+
*webpack_args(cli)
|
28
30
|
if $?.success?
|
29
31
|
File.read(file.path).tap { file.tap(&:unlink).close }
|
30
32
|
else
|
@@ -34,8 +36,18 @@ class Nanoc::Webpack::Filter < Nanoc::Filter
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
def
|
38
|
-
|
39
|
+
def webpack_args(args)
|
40
|
+
args.each_with_object([]) do |(key, value), ary|
|
41
|
+
if value.equal?(true)
|
42
|
+
ary << key
|
43
|
+
else
|
44
|
+
ary.concat [key, value.to_s]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def temporary_file_for(content)
|
50
|
+
dir = File.join(Dir.getwd, "tmp", "nanoc-webpack.rb")
|
39
51
|
mkdir_p(dir) unless Dir.exist?(dir)
|
40
52
|
file = Tempfile.new(File.basename(item.identifier.to_s), dir)
|
41
53
|
file.write(content)
|
data/nanoc-webpack.rb.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.licenses = ["0BSD"]
|
11
11
|
gem.files = `git ls-files`.split($/)
|
12
12
|
gem.require_paths = ["lib"]
|
13
|
-
gem.summary = "
|
13
|
+
gem.summary = "nanoc-webpack.rb integrates webpack into nanoc."
|
14
14
|
gem.description = gem.summary
|
15
15
|
gem.add_runtime_dependency "ryo.rb", "~> 0.4"
|
16
16
|
gem.add_development_dependency "yard", "~> 0.9"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-webpack.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- '0x1eef'
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ryo.rb
|
@@ -94,13 +94,14 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '2.11'
|
97
|
-
description:
|
97
|
+
description: nanoc-webpack.rb integrates webpack into nanoc.
|
98
98
|
email:
|
99
99
|
- 0x1eef@protonmail.com
|
100
100
|
executables: []
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".bundle/config"
|
104
105
|
- ".github/workflows/specs.yml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".projectile"
|
@@ -136,8 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
137
|
- !ruby/object:Gem::Version
|
137
138
|
version: '0'
|
138
139
|
requirements: []
|
139
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.5.3
|
140
141
|
signing_key:
|
141
142
|
specification_version: 4
|
142
|
-
summary:
|
143
|
+
summary: nanoc-webpack.rb integrates webpack into nanoc.
|
143
144
|
test_files: []
|