Class: WebpackNative::DevGenerator

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

Instance Method Summary collapse

Instance Method Details

#generate_development_assetsObject

[View source]

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/webpack_native/dev_generator.rb', line 3

def generate_development_assets
  compiling_notice = "Compiling for development..."
  puts "\n" + "\e[36m#{compiling_notice}\e[0m" + "\n\n"

  Mutex.new.synchronize do
    Dir.chdir "#{Rails.root}/app/webpack_native" do
      Dir.mkdir('src/images') unless Dir.exist?('src/images')
      Dir.mkdir('src/favicons') unless Dir.exist?('src/favicons')
      %x{ yarn install }
      result = %x{ npm run build:dev }
      puts "\n"
      puts result
    end
  end
end