- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们正在使用 Webpacker用于装载 JavaScripts
和 CSS
文件进入网页。
目前,在 webpacker.yml
我们已经设置了 source_path
至 app/javascript
.从这个目录加载 JavaScript 文件工作正常。
但是在我们的应用程序中,我们有一个 engines
目录,以及所有 JavaScript
文件位于不同的 engines
在 engines
目录,为了加载这些 JavaScript 文件,我们创建了一个 link
在 app/javascript/packs
引擎目录中的每个包。
有没有更好的方法来做到这一点,而无需提供链接 或 通过提供多个 source_path
在 webpacker.yml
文件。
以供引用:
This is the folder structure currently we have:
-root
|
|-app
|-javascript
|-packs
|-[link to engine1.js pack files]
|-[link to engine2.js pack files]
|-engines
|- engine1
|-app
|-javascript
|-packs
|-engine1.js
|- engine2
|-app
|-javascript
|-packs
|-engine1.js
And this is how the
webpacker.yml
configuration
default: &default
source_path: app/javascript
source_entry_path: packs
public_output_path: packs
cache_path: tmp/cache/webpacker
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: ['app/assets']
最佳答案
我想你会想做这样的事情:
additional_paths: ['engines']
来源:
https://github.com/rails/webpacker#resolved
If you are adding Webpacker to an existing app that has most of the assets inside app/assets or inside an engine, and you want to share that with webpack modules, you can use the additional_paths option available in config/webpacker.yml. This lets you add additional paths that webpack should lookup when resolving modules:
关于ruby-on-rails - 如何在 Rails Webpacker 中添加多个 source_path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50982724/
有什么区别 cp -R source_path target_path 对比 cp -R source_path/* target_path 我发现第二个 cmd 在我的 amazon linux 系
我们正在使用 Webpacker用于装载 JavaScripts和 CSS文件进入网页。 目前,在 webpacker.yml我们已经设置了 source_path至 app/javascript .
我是一名优秀的程序员,十分优秀!