Update nanoc-webpack.rb

This commit is contained in:
0x1eef 2024-06-14 17:12:39 -03:00
parent 47a39afa37
commit 3b6fe3592a
4 changed files with 14 additions and 14 deletions

View file

@ -8,7 +8,7 @@ gem "nanoc", "~> 4.12"
##
# filters
gem "nanoc-gzip.rb"
gem "nanoc-webpack.rb"
gem "nanoc-webpack.rb", "~> 0.10.3"
gem "nanoc-tidy.rb", "~> 0.8"
gem "rainpress", "~> 1.0"
gem "sass", "~> 3.7"

View file

@ -64,7 +64,7 @@ GEM
nanoc (~> 4.12)
nanoc-tidy.rb (0.8.0)
test-cmd.rb (~> 0.12.2)
nanoc-webpack.rb (0.10.1)
nanoc-webpack.rb (0.10.3)
ryo.rb (~> 0.5)
test-cmd.rb (~> 0.12.2)
nio4r (2.7.1)
@ -111,7 +111,7 @@ GEM
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (1.13.0)
ryo.rb (0.5.1)
ryo.rb (0.5.3)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
@ -157,7 +157,7 @@ DEPENDENCIES
nanoc (~> 4.12)
nanoc-gzip.rb
nanoc-tidy.rb (~> 0.8)
nanoc-webpack.rb
nanoc-webpack.rb (~> 0.10.3)
paint (~> 2.3)
rainpress (~> 1.0)
ryo.rb

18
Rules
View file

@ -2,7 +2,7 @@
# frozen_string_literal: true
##
# requires
# Requires
require "ryo"
require "ryo/json"
require "nanoc-gzip"
@ -10,12 +10,12 @@ require "nanoc-webpack"
require "nanoc-tidy"
##
# variables
# Configuration
locales = %w[ar fa en]
json_dir = File.join(Dir.getwd, "src", "json")
name_by_id = Ryo.from_json_file("#{json_dir}/nameById.json")
tdata = Ryo.from_json_file("#{json_dir}/t.json")
buildenv = ENV["buildenv"] || "development"
name_by_id = Ryo.from_json(path: File.join(json_dir, "nameById.json"))
tdata = Ryo.from_json(path: File.join(json_dir, "t.json"))
buildenv = ENV["buildenv"] || "development"
##
# DSL extensions
@ -23,7 +23,7 @@ Nanoc::RuleDSL::CompilationRuleContext.prepend(Nanoc::RuleDSL::Filter)
Nanoc::RuleDSL::CompilerDSL.prepend(Nanoc::RuleDSL::RequireRules)
##
# plugins
# Plugins
Nanoc::Webpack
.default_argv
.concat ["--config", "webpack.#{buildenv}.js"]
@ -32,7 +32,7 @@ Nanoc::Tidy
.concat ["-upper"]
##
# see packages/typescript/postman
# See packages/typescript/postman
compile "/css/vendor/postman.scss" do
filter :sass, syntax: :scss, style: :compact
filter :rainpress
@ -58,7 +58,7 @@ end
passthrough "/json/durations/*.json"
##
# require rules
# Require rules
require_rules "nanoc/rules/assets"
require_rules "nanoc/rules/redirect", {locales:}
require_rules "nanoc/rules/random", {locales:, tdata:}
@ -66,6 +66,6 @@ require_rules "nanoc/rules/stream", {locales:, tdata:, name_by_id:}
require_rules "nanoc/rules/index", {locales:, tdata:}
##
# defaults
# Catch-all
compile("/**/*") { write(nil) }
layout("**/*", :erb)

View file

@ -9,7 +9,7 @@ module Mixin::T
def tdata
@tdata ||= begin
path = File.join(Dir.getwd, "src", "json", "t.json")
Ryo.from_json_file(path)
Ryo.from_json(path:)
end
end
end