3

If we include files in our Magento2 custom module, that should be added to the pub/media directory...how do we go about ensuring they are added?

Ive created the required media dir sub-directory via the upgradeSchema setup script, and i'm currently playing with the modules composer.json file to try get these files copied across. But this isn't quote working. Any advice on how this should be achieved please?

Composer file has the following. First line is the path in my module where the files are located. Second line is the path i want the files to be copied to:

"extra": {
    "map": [
        [
            "pub/media/dd_library/default/*",
            "pub/media/dd_library/default/"
        ]
    ]
},

== UPDATE == Seems to install media directory assets from a custom module, you need to create a seperate basic module set as a magento2-component in the composer.json. Then install both modules via composer. Worked this out from the Magento2 sample data packages.

  • If the field is added correctly, the file will be added correctly – PЯINCƏ Jul 17 '18 at 15:12
  • Please clarify your reply. Ive updated the question. – UUDotCom Jul 17 '18 at 15:18