Sha256: 506985657f7275e5b394f2694dcc708d78b813b99a1a7448bf53d5a64f462b52

Contents?: true

Size: 791 Bytes

Versions: 4

Compression:

Stored size: 791 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_r Dir.glob(Rails.root.join("app/assets/javascripts/generated/*"))
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
react_on_rails-1.1.1 lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake
react_on_rails-1.1.0 lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake
react_on_rails-1.0.3 lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake
react_on_rails-1.0.2 lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake