The project is in a healthy, maintained state
nanoc-webpack.rb integrates webpack into nanoc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3.5
~> 3.10
~> 1.13
~> 0.9

Runtime

~> 0.5
 Project Readme

About

nanoc-webpack.rb is a nanoc filter that integrates webpack into nanoc.
The filter acts as a bridge that connects nanoc, and the JavaScript, TypeScript, and nodejs ecosystems.

Examples

Defaults

The following example forwards the entry point /js/main/App.tsx to webpack.
The result is then written to /js/main/app.js:

# Rules
require "nanoc-webpack"
compile "/js/main/App.tsx" do
  filter(:webpack)
  write("/js/main/app.js")
end

Option: depend_on

When a file or directory tracked by the depend_on option is observed to have changed, nanoc will initiate a recompilation of the entry point:

# Rules
require "nanoc-webpack"
compile "/js/main/App.tsx" do
  filter(:webpack, depend_on: ["/js/lib", "/js/components", "/js/hooks"])
  write("/js/main/app.js")
end

Option: reject

The depend_on option can be combined with the reject option to exclude certain files or directories from being tracked. For example, maybe you want to track /js/lib/ but not /js/lib/foo/:

# Rules
require "nanoc-webpack"
compile "/js/main/App.tsx" do
  filter :webpack,
         depend_on: ["/js/lib", "/js/components", "/js/hooks"],
         reject: proc { |path| path.start_with?("/js/lib/foo/") }
  write("/js/main/app.js")
end

Option: argv

The argv option forwards command line arguments directly to the webpack executable.
Nanoc::Webpack.default_argv returns the default command line arguments forwarded to webpack:

# Rules
require "nanoc-webpack"
compile "/js/main/App.tsx" do
  filter(:webpack, argv: ["--config", "webpack.production.js"])
  write("/js/main/app.js")
end

Install

Rubygems.org

nanoc-webpack.rb can be installed via rubygems.org

gem install nanoc-webpack.rb

See also

Sources

License

BSD Zero Clause.
See LICENSE.