How to publish assets to public/ when installing a module via Composer? #168
-
|
Hi! 👋 I'm currently testing my OpenMage module (openmage-search), which is installable via Composer. "extra": {
"map": [
["app/code/community/MM/Search", "app/code/community/MM/Search"],
["app/etc/modules/MM_Search.xml", "app/etc/modules/MM_Search.xml"],
["app/design/frontend/base/default/layout/mm_search.xml", "app/design/frontend/base/default/layout/mm_search.xml"],
["app/design/frontend/base/default/template/mm/search", "app/design/frontend/base/default/template/mm/search"],
["app/design/adminhtml/default/default/template/mm/search", "app/design/adminhtml/default/default/template/mm/search"],
["skin/frontend/base/default/css/mm_search", "skin/frontend/base/default/css/mm_search"],
["skin/frontend/base/default/js/mm_search", "skin/frontend/base/default/js/mm_search"]
]
},Installation works fine, and extension code are loaded from vendor app/, but I’m wondering: How can I automatically publish my static assets (e.g., JS, CSS, images) into the public/ folder upon installation? Currently, I had to manually copy the two folders Is there a recommended approach within Maho (or inherited from OpenMage) for this? Here’s the project:
Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 17 replies
-
|
Hey @empiricompany, everything in the "skin" folder should be copied automatically but there could be a change/difference/bug with the latest version of plugin, for sure @justinbeaty knows what's going on but I'll also check it as soon as possible |
Beta Was this translation helpful? Give feedback.
-
|
Neither I don't believe we have ever automatically copied files from a module's public folders, but FileCopyPlugin.php is where this should be implemented, and the file mapping from However there were a few sticky points, such as what happens if a user wants to override a file in public, or if two modules defines the same file. One possible solution is putting public files from modules into One other thought I've had on the subject is that it would be pretty nice if we could minify CSS / JS during the copy. That would make it so we don't have to worry about bloat when adding JSDoc comments in the main maho repo. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.



Neither
modmannorextra.mapactually work for the public folder. That's because those methods only create non-public symlinks in the vendor dir for the purpose of autoloading PHP files, as well as loading xml and csv files.I don't believe we have ever automatically copied files from a module's public folders, but FileCopyPlugin.php is where this should be implemented, and the file mapping from
modmanandextra.mapcan be supported here.However there were a few sticky points, such as what happens if a user wants to override a file in public, or if two modules defines the same file. One possible solution is putting public files from modules into
public/vendoror something similar. We wou…