cancel
Showing results for 
Search instead for 
Did you mean: 

Change merge css name generated

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Change merge css name generated

Hi,

 

In order to refresh my client browser with the last styles, I want to change the name of the generated files when I merge them.

 

What... where that name is generated?

 

I merge the css with System > Configuration > Developer > Css Settings > Merge CSS Files to Yes.

It generate a css like 9128734598173458912.css, but it's always the same name, and I want to change it each time I merge the css even the content doesn't change.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Change merge css name generated

Hello @leed

 

please check below file for same

 

Mage_Core_Model_Design_Package

 

You will find 

Mage/Code/Model/Design/Package.php

There is one function

 public function getMergedCssUrl($files)
{
 ....
 $targetFilename = md5(implode(',', $files) . "|{$hostname}|{$port}") . '.css'; //
you need to change 
 $targetFilename = 'test'.md5(implode(',', $files) . "|{$hostname}|{$port}"). '.css';
....................
}

Hope it will help you.

 

If work then mark as solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

4 REPLIES 4

Re: Change merge css name generated

Hello @leed

 

Please enable static sign on for that.

 

https://devdocs.magento.com/guides/v2.2/config-guide/cache/static-content-signing.html

 

Hope it will help you if will help you then mark as the solution or give kudos.

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Change merge css name generated

I need to do that in Magento 1.x

Re: Change merge css name generated

Hello @leed

 

please check below file for same

 

Mage_Core_Model_Design_Package

 

You will find 

Mage/Code/Model/Design/Package.php

There is one function

 public function getMergedCssUrl($files)
{
 ....
 $targetFilename = md5(implode(',', $files) . "|{$hostname}|{$port}") . '.css'; //
you need to change 
 $targetFilename = 'test'.md5(implode(',', $files) . "|{$hostname}|{$port}"). '.css';
....................
}

Hope it will help you.

 

If work then mark as solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Change merge css name generated

Perfect, thank you!!