Class: ActiveMail::Generators::StylesGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/activemail/styles_generator.rb

Constant Summary collapse

TARGET_DIR =
File.join('app', 'assets', 'stylesheets', 'activemail')

Instance Method Summary collapse

Instance Method Details

#copy_stylesObject

The .scss.erb token bridge is deliberately not ejected: it needs ERB preprocessing, and tokens come from Ruby config (rake activemail:tokens:export).



15
16
17
18
19
20
21
# File 'lib/generators/activemail/styles_generator.rb', line 15

def copy_styles
  Dir.children(self.class.source_root).each do |name|
    next if name.end_with?('.erb')

    copy_file name, File.join(TARGET_DIR, name)
  end
end

#show_readmeObject



23
24
25
26
27
# File 'lib/generators/activemail/styles_generator.rb', line 23

def show_readme
  say "\nEjected the ActiveMail SCSS partials to #{TARGET_DIR}.", :green
  say 'Token values come from Ruby (config.tokens.color/font/spacing). For a static'
  say 'SCSS partial of those values, run `rake activemail:tokens:export`.'
end