I created a new theme in Magento 2 extending the default Magento Luma theme.

However, now I want to make some very specific customizations to all CSS and JS files referenced in the <HEAD>.

I want to change all CSS references that look like this:

<link  rel="stylesheet" type="text/css"  media="all" href="https://my-magento-url/pub/static/version1574090503/frontend/restive/magedot/en_US/mage/calendar.css" />

to look like this:

<link  rel="stylesheet" type="text/css/custom"  media="all" href="https://my-magento-url/pub/static/version1574090503/frontend/restive/magedot/en_US/mage/calendar.css" />

and all JS references that look like this:

<script  type="text/javascript"  src="https://my-magento-url/pub/static/version1573830556/frontend/Magento/luma/en_US/requirejs/require.js"></script>

to look like this:

<script  type="text/javascript/custom"  src="https://my-magento-url/pub/static/version1573830556/frontend/Magento/luma/en_US/requirejs/require.js"></script>

Notice that the type attribute changes from text/{file_type} to text/{file_type}/custom, where {file_type} is either css or javascript.

What files need to be updated/extended to make this work?


for values allowed for the type attribute check this, but why do you want this change for css/js files?

| 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.