module Lookbook::PathUtils
def to_lookup_path(file_path)
def to_lookup_path(file_path) path = file_path.to_s.downcase directory_path = File.dirname(path) directory_path = nil if directory_path.start_with?(".") file_name = File.basename(path).split(".").first segments = [*directory_path&.split("/"), file_name].compact stripped_segments = segments.map! do |segment| PriorityPrefixParser.call(segment).last.tr("-", "_") end to_path(stripped_segments) end