Sha256: 13ffc7c9c891831092411c9b99015d81215b8c8a22abf1e160426ef584ea5b5d

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

# lib/tasks/assets.rake
# The webpack task must run before assets:environment task.
# Otherwise Sprockets cannot find the files that webpack produces.
# This is the secret sauce for how a Heroku deployment knows to create the webpack generated JavaScript files.
Rake::Task["assets:precompile"]
  .clear_prerequisites
  .enhance(["assets:compile_environment"])

namespace :assets do
  # In this task, set prerequisites for the assets:precompile task
  task compile_environment: :webpack do
    Rake::Task["assets:environment"].invoke
  end

  desc "Compile assets with webpack"
  task :webpack do
    sh "cd client && npm run build:client"
    sh "cd client && npm run build:server"
  end

  task :clobber do
    rm_rf "#{Rails.application.config.root}/app/assets/javascripts/generated/vendor-bundle.js"
    rm_rf "#{Rails.application.config.root}/app/assets/javascripts/generated/client-bundle.js"
    rm_rf "#{Rails.application.config.root}/app/assets/javascripts/generated/server-bundle.js"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
react_on_rails-1.0.1 lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake
react_on_rails-1.0.0 lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake