cancel
Showing results for 
Search instead for 
Did you mean: 

CSS update does not show on the site or browser/debug/inspect

CSS update does not show on the site or browser/debug/inspect

Hello i have made a simple change to the theme.css file of a magento them for a layout issue and i cannot get it to show on the site


Preconditions

  1. Magento community 2.1.2
  2. VPS, Operating System: CentOS 7.x (64 Bit), PHP version: 7.0.25, apache
  3. live site

Steps to reproduce

  1. changed theme.css in theme pub folder on server
  2. saved/uploaded
  3. press save

Expected result

  1. layout issue should be resolved or at least the added css show up in inspection/debug mode in chrome or firefox with clean cache or ingognito

Actual result

added css does not show in the css file when using chrome/firefox inspect tool ie it seems to be looking at an old cache/file

 

I have done the following aswell, and ran flush magento, and ran php bin/magento indexer:reindex and refreshed index management blocks etc

Flushed Catalog Images Cache Pregenerated product images files

Flushed JavaScript/CSS Cache Themes JavaScript and CSS files combined to one file

Flushed Static Files Cache Pre processed view files and static files

 

i also went into cpanel/filemanager and deleted all of the merged files in /pub/static/_cache/merged  and then ran all the reindex and flushes again and still does not show in inspection tool - 

 

 

4 REPLIES 4

Re: CSS update does not show on the site or browser/debug/inspect

I suppose you develop in not the developer mode, so you can try the following: 

remove content of the next directories:

-(magento root path)/pub/static/_cache/

-(magento root path)/pub/static/frontend/

-(magento root path)/pub/static/adminhtml/ (not necessary but I do it anyway)

-(magento root path)/pub/static/deployed_version.txt

After that execute command in the terminal from the magento root directory:

php bin/magento setup:static-content:deploy (if you are using magento version < 2.2.*). If higher, php bin/magento setup:static-content:deploy -f

 

Oh, actually I see, that it is live site. So you should better not do that.

Change file theme.css under the app/design folder. After that run above commands and then clean the cache:

php bin/magento cache:clean

php bin/magento cache:flush

(but you should test it first on the dev- or test-site)

Re: CSS update does not show on the site or browser/debug/inspect

hello dmoisej thanks for your reply, your reply says run php bin/magento setup:static-content:deploy (if you are using magento version < 2.2.*) but im using 2.1.2

 

it also says If higher, php bin/magento setup:static-content:deploy -f -

 

but im on the lower version 2.1.2?

also i recognise that static deploy function and last time i ran it i had to have my whole site rebuilt as it got a http 500 error so im reluctant to running that command

 

with regards to the css file to update i see more than one - ie ....

 

 

public_html/app/design/frontend/Mgs/luxury/web (theme.less)
public_html/app/design/frontend/Mgs/luxury/web/css (theme.less)

public_html/app/design/frontend/Mgs/mgsblank/web/css (theme.less)

 

i changed the css in these files 

public_html/app/design/frontend/Mgs/luxury/web (theme.less)
public_html/app/design/frontend/Mgs/luxury/web/css (theme.less)

 

then flushed all caches and ran reindex in ssh but still it does not show

 

 

 

 

Re: CSS update does not show on the site or browser/debug/inspect

actually i think that did work but i thought it had nto as there must of been a few minutes delay somehow!

 

thanks for the tip 

Re: CSS update does not show on the site or browser/debug/inspect

If you are using version 2.1.2 you should run 

php bin/magento setup:static-content:deploy

 

You must not hesitate about using this command. Do not just change pub/static files, cause if some other developers will be working with your website, then I think they might clean pub/static/.. folder and redeploy all files in order to make their extensions or customization work.

 

One more tip. In order not to see 500 error on the live site, set your website to the production mode. But if the site runs in the production mode, you will definitely have to run setup:static-content:deploy. 

 

So have you managed to fix your problem?