nanoc-webpack.rb 0.5.0 → 0.5.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 +4 -4
- data/README.md +1 -1
- data/lib/nanoc/webpack/filter.rb +11 -3
- data/lib/nanoc/webpack/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51ae4d18b8017151427e4a4e309b43340c410028fe4f3c4c439d936ed9bae1f0
|
4
|
+
data.tar.gz: ad20aeb40452f97f97f1271f0340ccf44a98e10f7e72b21da9aadd61b7245d65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f3cc7d3ac650928ed0f5328de72ab18f64b33dd79894269d9b723dc2a6378ee490a6a78779b74b0799c08f471e6292f3f981ce69cceea3c0bcf270c3cd96dde
|
7
|
+
data.tar.gz: 5404a3781b264975ef4222c019654dc7ef53e1d0d292e4c11745a3d5c6b0b20ddb9000f4b3288d6dc1c4855020c6a4413c2621c2dc6a2d4663c1ea59b9a69c04
|
data/README.md
CHANGED
data/lib/nanoc/webpack/filter.rb
CHANGED
@@ -11,22 +11,30 @@ class Nanoc::Webpack::Filter < Nanoc::Filter
|
|
11
11
|
identifier :webpack
|
12
12
|
type :text
|
13
13
|
|
14
|
+
##
|
15
|
+
# @return [Hash]
|
16
|
+
# Returns the default command-line options given
|
17
|
+
# to the webpack executable.
|
18
|
+
def self.default_options
|
19
|
+
@default_options ||= {}
|
20
|
+
end
|
21
|
+
|
14
22
|
def run(content, options = {})
|
15
23
|
depend_on dependable(paths: options[:depend_on], reject: options[:reject])
|
16
24
|
.map { items[_1] }
|
17
25
|
webpack temporary_file_for(content),
|
18
|
-
args: options[:args]
|
26
|
+
args: self.class.default_options.merge(options[:args])
|
19
27
|
end
|
20
28
|
|
21
29
|
private
|
22
30
|
|
23
|
-
def webpack(file, args:
|
31
|
+
def webpack(file, args: {})
|
24
32
|
system "node",
|
25
33
|
"./node_modules/webpack/bin/webpack.js",
|
26
34
|
"--entry", File.join(Dir.getwd, item.attributes[:content_filename]),
|
27
35
|
"--output-path", File.dirname(file.path),
|
28
36
|
"--output-filename", File.basename(file.path),
|
29
|
-
*webpack_args(
|
37
|
+
*webpack_args(args)
|
30
38
|
if $?.success?
|
31
39
|
File.read(file.path).tap { file.tap(&:unlink).close }
|
32
40
|
else
|