webpack在symfony-(dev)-docker环境中的无缝集成

我目前正在从symfony资产捆绑到webpack的迁移工作。 他们说:“这很容易。 他们说:“你可以随时切换。 现在我第二天就没事了。

让我描述一下环境:

我们有一些docker-compose处理的docker集装箱:

  • nginx的
  • PHP-FPM
  • 节点(节点:最新的附加纱线)
  • …一些其他人(这里是无关紧要的)

这是一个标准的symfony 3.3应用程序,具有以下结构:

app Resources assets scss some-common.scss common.js src ABundle Resources assets js some.js another.js common.js bundle.js BBundle Resources assets js some-other.js scss custom-font.scss jet-another.scss font custom.ttf custom... img some.jpg bundle.js vendor user/bundle src UserBundle Resources assets js other.js scss another.scss img some-other.jpg common.js bundle.js web static <= the output manifest.json <= is required for get the the filenames for symfony abundle.somecrpytichash.js bbundle.somecrpytichash.css bbundle.somecrpytichash.js userbundle.somecrpytichash.js userbundle.somecrpytichash.css common.somecrpytichash.js common.somecrpytichash.css custom.ttf custom.... some.jpg (or another autogenerated name, eg. also with hash) some-other.jpg 

现在更详细的描述,我很难得到:

在开发案例中,docker集装箱“节点”应该处于观察模式,观察资产变化的变化。 另外如果可能HMR正在工作(它的CAN,不是必须的) – “节点”容器可用于其他容器和任何端口可以映射。 (webpack-hot-middleware是否正确?

命名遵循简单的roules:全局应用程序所需的所有代码将在common.js入口点中find。 它可以是像jQuery或基础站点的外部依赖关系或来自捆绑本身。 而bundle.js则包含了这个bundle中只需要的所有代码。

最后,每个站点上应该只有(最多)2个js,common.js和bundle specific.js文件以及css文件(common和bundle)。

web / static文件夹中的文件(和文件夹结构)的名称具有示例性质。 唯一需要的是,输出得到散列,因为它更好的部署。

似乎很容易描述,但不build立它: – /