Class: Suspenders::AutoprefixerGenerator

Inherits:
Generators::Base
  • Object
show all
Defined in:
lib/suspenders/generators/autoprefixer_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#add_autoprefixer_railsObject



5
6
7
8
# File 'lib/suspenders/generators/autoprefixer_generator.rb', line 5

def add_autoprefixer_rails
  gem 'autoprefixer-rails'
  Bundler.with_clean_env { run "bundle install" }
end

#copy_browserslistrcObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/suspenders/generators/autoprefixer_generator.rb', line 10

def copy_browserslistrc
  if behavior == :invoke
    list = <<~TEXT
      last 1 version
      > 5%
      not IE 11
    TEXT
    in_root do
      File.open('.browserslistrc', 'w') do |file|
        file << list
      end
    end
  else
    in_root do
      File.open('.browserslistrc', 'w') do |file|
        file << 'defaults'
      end
    end
  end
end