Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Last active September 6, 2023 08:12
Show Gist options
  • Save peterjaap/b1b1fa6188ea1e0c8dfa5b336f2fb89b to your computer and use it in GitHub Desktop.
Save peterjaap/b1b1fa6188ea1e0c8dfa5b336f2fb89b 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']));
@barryvdh
Copy link

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())]

@markusvonplunkett
Copy link

amazing!

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