Skip to content

Instantly share code, notes, and snippets.

@markusvonplunkett
Forked from peterjaap/identify.php
Created September 6, 2023 08:12
Show Gist options
  • Save markusvonplunkett/fce64b3825a04985653162e934c962e2 to your computer and use it in GitHub Desktop.
Save markusvonplunkett/fce64b3825a04985653162e934c962e2 to your computer and use it in GitHub Desktop.
Identify used Magento 2 frontend extensions in a Luma install
<?php
// Run with the URL pointing to a require-config.js as the first argument;
// php identify.php http://magento2demo.firebearstudio.com/pub/static/frontend/Magento/luma/en_US/requirejs-config.js
$content = file_get_contents($argv[1]);
preg_match_all(
'/(?P<quote>\'|")(?P<extension>[[:alnum:]]+_[[:alnum:]]+)\/js\/.+?(?P=quote)/m',
$content,
$matches
);
sort($matches['extension']);
print_r(array_unique($matches['extension']));
@markusvonplunkett
Copy link
Author

markusvonplunkett commented Sep 6, 2023

Javascript version you can use in your console on a Magento2 site (with RequireJS)

[...new Set(Object.entries(requirejs.s.contexts._.config.map['*']).filter(path => path[1].includes('') && path[1].includes('/js/')).map(path => path[1].split('/')[0]).sort())]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment