I have created one module but module images and css not accessible from web folder. its access only one time. second time not accessible.


We have try $block->getViewFileUrl() and $this->getViewFileUrl() but no luck with this.

I don't know why added _view in /mage2ex/pub/static/frontend/_view/


You can access images directly in your custom Module images e.g Vendor_Module/view/frontend/web/images/my_image.jpg can be accessed in css as follow:

background-image: url('@{baseDir}Vendor_Module/images/my_image.jpg');
| improve this answer | |

Finally i got solution using parameter with $block->getViewFileUrl();

echo $block->getViewFileUrl('NS_Module::js/jquery-1.12.4.min.js', array(
    'area'  => 'frontend',
    'theme' => 'Magento/luma'
| improve this answer | |

After created module when you apply commands and run your website your css and js will be loaded first time and it will display from cache folder like


so your frontend will execute fast

| improve this answer | |

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.