3

In Magento 2, a static asset URL from a module looks like this

http://example.magento.com/static/frontend/Magento/blank/en_US/Pulsestorm_FrontendTutorial1/hello.js

What's the Magento for between the area and theme? (frontend/Magento/blank). Is this hardcoded somewhere to Magento? Is it a name that's configurable per "Magento Application". Something else?

i.e. I know this is where Magento ends up generating the static asset files for the product, but what does this part of the URL represent, and where is Magento's core code pulling it from?

  • Great question. I personally don't like having the module names in the asset paths either – Robbie Averill Dec 27 '15 at 19:58
5

if you create your theme inside app/design/yourVendor/Youtheme and activated your theme the assets url will be change to : http://example.magento.com/static/frontend/yourVendor/Youtheme/en_US/Pulsestorm_FrontendTutorial1/hello.js Magento create hello.js for every theme already declared inside registration.php , Magento equal yourVendor (almost interface for m1) ok if you go to table theme in db you will find theme_path yourVendor/Youtheme the model related is Magento\Theme\Model\Theme

Magento for Getting a static view file name, using fallback mechanism passed as parameters:

getFile($area, ThemeInterface $themeModel, $locale, $file, $module = null)

is ThemeInterface $themeModel

for assets as your case all big players i find inside vendor/magento/framework/View/Asset as example the intern system use (vendor/magento/framework/View/Asset/File.php):

public function getPath()
{
    $result = '';
    $result = $this->join($result, $this->context->getPath());
    $result = $this->join($result, $this->module);
    $result = $this->join($result, $this->filePath);
    $result = $this->minification->addMinifiedSign($result);
    return $result;
}

in the beta version the blank it's simple to view it's located inside app/design/Magento/blank but in rc all is stocked inside vendor for blank is : vandor/magento/theme-frontend-blank like modules and framwork ..

  • So to clarify, Magento is the vendor of the theme, whereas Pulsestorm etc is the vendor of the module? – Robbie Averill Dec 27 '15 at 23:36
  • 1
    @RobbieAverill That's right -- Pulsestorm_FrontendTutorial1 is the module name. The full theme name is Magento/blank -- with Magento being the theme's vendor, and blank being the theme's name. – Alan Storm Dec 28 '15 at 4:55
1

As described in documentation Magento is Vendor Name (for Magento_blank theme).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.