class Jektify::Generator

Public Instance Methods

asset_files() click to toggle source

Get paths and fils directory 'assets'

# File lib/jektify/main.rb, line 50
def asset_files
  asset_files = []
  Find.find(ENGINE.assets_path).each do |path|
    next if File.directory?(path)
    next if path.include?(ENGINE.stylesheets_sass_path)
    asset_files << path.sub(ENGINE.assets_path, 'assets')
  end
  asset_files
end
generate(site) click to toggle source
# File lib/jektify/main.rb, line 24
def generate(site)
  # Before, verify structure Jektify in _config.yml
  ENGINE.yml_verify(APP_ROOT_CONFIG)

  @site = site

  # It will only generate the Javascript file for the user, if the 'Toggle' feature is enabled in the file "_config.yml".
  if APP_ROOT_CONFIG["enable"] == true
    @site.static_files.concat static_files if APP_ROOT_CONFIG["toggle"].nil? || APP_ROOT_CONFIG["toggle"]["enable"] == true
  end
  ENGINE.copy_sass_manual(APP_ROOT_CONFIG)
end
static_files() click to toggle source

This method searches for folders and files in the assets root directory. After searching all files stores in an array and then copying to the folder “_site”.

# File lib/jektify/main.rb, line 40
def static_files
  source = File.dirname(ENGINE.assets_path)
  asset_files.map do |file|
    dir = File.dirname(file)
    file_name = File.basename(file)
    Jekyll::StaticFile.new @site, source, dir, file_name
  end
end