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 commit129f8ac6ff
. See02d2958b6c (commitcomment-31849196)
This commit is contained in:
parent
02d2958b6c
commit
814b3cbdea
2 changed files with 9 additions and 0 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue