aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-01-17 15:35:51 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-01-17 15:35:51 +0100
commitb1c08d8d9b921fdcf3813b5c20a0c3fab96eccca (patch)
tree94899fc7a6f784c71bac19acf54ecc60df6f36aa /railties/lib
parent146e9288001986cd3cfb2513ba8a606e00aeb61a (diff)
downloadrails-b1c08d8d9b921fdcf3813b5c20a0c3fab96eccca.tar.gz
rails-b1c08d8d9b921fdcf3813b5c20a0c3fab96eccca.tar.bz2
rails-b1c08d8d9b921fdcf3813b5c20a0c3fab96eccca.zip
Make yarn install available as a rake task via yarn:install so we can use that as a dependency for assets:precompile
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/tasks/yarn.rake9
1 files changed, 9 insertions, 0 deletions
diff --git a/railties/lib/rails/tasks/yarn.rake b/railties/lib/rails/tasks/yarn.rake
new file mode 100644
index 0000000000..a7d37c9bdf
--- /dev/null
+++ b/railties/lib/rails/tasks/yarn.rake
@@ -0,0 +1,9 @@
+namespace :yarn do
+ desc "Install all JavaScript dependencies as specified via Yarn"
+ task :install do
+ system('./bin/yarn')
+ end
+end
+
+# Run Yarn prior to Sprockets assets precompilation, so dependencies are available for use.
+Rake::Task['assets:precompile'].enhance [ 'yarn:install' ]