Module: GovukPublishingComponents::Config

Defined in:
lib/govuk_publishing_components/config.rb

Constant Summary collapse

APP_COMPONENT_DIRECTORY =
"components".freeze

Class Method Summary collapse

Class Method Details

.all_stylesheetsObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/govuk_publishing_components/config.rb', line 35

def self.all_stylesheets
  stylesheets = Dir.glob("#{gem_directory}/app/assets/stylesheets/govuk_publishing_components/components/*.scss")
  # _copy-to-clipboard.css is removed due to being an empty stylesheet
  included_files = stylesheets.reject { |path| path.include?("copy-to-clipboard") }

  application_stylesheet_hash = { "#{gem_directory}/app/assets/stylesheets/component_guide/application.scss" => "component_guide/application.css" }

  included_files.each_with_object(application_stylesheet_hash) do |path, hsh|
    hsh[path] = "govuk_publishing_components/components/#{File.basename(path, '.*')}.css"
  end
end

.component_directory_nameObject



27
28
29
# File 'lib/govuk_publishing_components/config.rb', line 27

def self.component_directory_name
  APP_COMPONENT_DIRECTORY
end

.gem_directoryObject



31
32
33
# File 'lib/govuk_publishing_components/config.rb', line 31

def self.gem_directory
  Gem::Specification.find_by_name("govuk_publishing_components").gem_dir
end