In Magento 2, is there a way, as a module developer, to share a javascript or css file between the frontend and adminhtml areas?

In Magento 2, your css and javascript files are kept in the following folders


This means, as a module developer, if I want to share a bit of javascript between the frontend and backend, I need to include it twice in my module.

Is there a built-in way to store a css/javascript file in one place, and have it included in both the frontend and backend?

If not, is there a convenient place to hook-in with a plugin or observer and manipulate [what I assume is the head block] directly?

1 Answer 1


Use the base area code for the common browser resources, and they will be available from the both frontend and adminhtml areas.

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.