1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Remove node_modules path from assets load paths since we use webpack by default"

This reverts commit 129f8ac6ff.

See 02d2958b6c (commitcomment-31849196)
This commit is contained in:
bogdanvlviv 2019-01-06 01:02:03 +02:00
parent 02d2958b6c
commit 814b3cbdea
No known key found for this signature in database
GPG key ID: E4ACD76A6DB6DFDD
2 changed files with 9 additions and 0 deletions

View file

@ -5,6 +5,10 @@ Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path. # Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path # Rails.application.config.assets.paths << Emoji.images_path
<%- unless options[:skip_javascript] -%>
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
<%- end -%>
# Precompile additional assets. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets # application.js, application.css, and all non-JS/CSS in the app/assets

View file

@ -346,11 +346,16 @@ module SharedGeneratorTests
run_generator run_generator
assert_file "#{application_path}/package.json", /dependencies/ assert_file "#{application_path}/package.json", /dependencies/
assert_file "#{application_path}/bin/yarn" assert_file "#{application_path}/bin/yarn"
assert_file "#{application_path}/config/initializers/assets.rb", /node_modules/
end end
def test_generator_for_yarn_skipped def test_generator_for_yarn_skipped
run_generator([destination_root, "--skip-javascript"]) run_generator([destination_root, "--skip-javascript"])
assert_no_file "#{application_path}/package.json" assert_no_file "#{application_path}/package.json"
assert_no_file "#{application_path}/bin/yarn" assert_no_file "#{application_path}/bin/yarn"
assert_file "#{application_path}/config/initializers/assets.rb" do |content|
assert_no_match(/node_modules/, content)
end
end end
end end