Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtnabe/b54bd944a97dfd503012fde68adeb433 to your computer and use it in GitHub Desktop.
Save wtnabe/b54bd944a97dfd503012fde68adeb433 to your computer and use it in GitHub Desktop.

Jekyll 側は lib/jekyll/site.rb で

https://github.com/jekyll/jekyll/blob/796ae15c31147d1980662744ef0f19a15a27cdee/lib/jekyll/site.rb#L18

    def initialize(config)
      # Source and destination may not be changed after the site has been created.
      @source          = File.expand_path(config["source"]).freeze
      @dest            = File.expand_path(config["destination"]).freeze

      self.config = config

      @cache_dir       = in_source_dir(config["cache_dir"])

こう解釈しているのに対して、JekyllVite 側は lib/jekyll/vite/config.rb で

https://github.com/ElMassimo/jekyll-vite/blob/main/lib/jekyll/vite/config.rb

module Jekyll::Vite::Config
  # Override: Provide default values for a typical Jekyll site.
  def config_defaults(**opts)
    require 'jekyll'
    cache_dir = Jekyll.configuration['cache_dir'] || '.jekyll-cache'
    super(**opts, mode: Jekyll.env).tap do |defaults|
      defaults['public_dir'] = cache_dir
      defaults['build_cache_dir'] = File.join(cache_dir, 'vite-build')
    end
  end
end

となって、Jekyll の in_source_dir() がない分パスがずれてしまう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment