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/

3 Answers 3


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');

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'

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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