File: generator.rb

package info (click to toggle)
ruby-js-image-paths 0.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 100 kB
  • ctags: 10
  • sloc: ruby: 37; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module JsImagePaths
  module Generator
    cattr_accessor :context

    def self.generate
      image_hash.to_json
    end

    def self.image_hash
      images = context.environment.each_logical_path(->(_, path) { path.include? "images" })
      images.each_with_object({}) do |path, images|
        images[path] = context.asset_path(path)
      end
    end
  end
end