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



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/govuk_publishing_components/config.rb', line 32

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



24
25
26
# File 'lib/govuk_publishing_components/config.rb', line 24

def self.component_directory_name
  APP_COMPONENT_DIRECTORY
end

.gem_directoryObject



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

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