Microthemer with Git?

This topic contains 12 replies, has 2 voices, and was last updated by  Sebastian 1 week, 2 days ago.

Author Posts

olleka

Hi
If I work on a development server and change some styles what is needed to move those to the live server?
I’m using Git for that.
And I can see that the active-styles.css have bee changed and moved to the new server to the correct location. But when I go to the live server the changes are not there.
If I go and have a look at the Generated CSS active-styles.css in the live server I can see that it is the stylesheet from the dev server.
I have deleted the cache (in WordPress)
Maybe it could be in the servers cache?

But the main question is if it is enough to move just the active-styles.css

Regards
Olle


Sebastian

Hi Olle,

Could you be specific about which changes are working on the development server that are not showing on the live site? If caching is not the cause, it could be due to some other differences between the dev and live site.

It will often be fine to just upload the active-styles.css file. But other times, it is best to export your local Microthemer settings to the live site. This will ensure everything is consistent, and means you can make Microthemer edits on the live site and safely overwrite the active-styles.css file uploaded from the dev site.

I can think of a few instances when exporting your settings will be necessary:

  1. You’ve used a background image that hasn’t been uploaded to the live site
  2. You’ve used a new Google font on the dev site
  3. You’ve used event-based animations with e.g. inView
  4. You’ve used the page-id modifier to make styles specific to a given page. And the page ids of your WP pages are out of sync with the local database. This one can’t actually be solved by exporting your settings. You should use the page-name modifier instead, just below the page-id modifier. That uses page URL slugs rather than ids. And these will be the same for live and local I imagine.

Does that help at all?

Thanks,
Sebastian


olleka

Hi
Ok thank you.
It’s just some smaller CSS edits nothing strange there. So I think the active-styles.css would be enough then,

I suspect there is some caching going on after all. On the server level. If I “trick” the browser to load a page without cache like
https://www.hamnen.se/?3456

On
https://www.hamnen.se
You can see the white gap between the black menu with the logo and the content.
But without cache it is gone like it is in the dev site.

I’ll talk to the server manager and see what can be done.

Regards
Olle


Sebastian

Ah OK, yes it probably is down to caching then 🙂


olleka

Well. I learned that the server cache is rebuilt every 30 minutes or so.

One strange thing is that if I go in to MT interface and look at the interface I can se that for instance a background image is at https://hamnen.se/wp-content/uploads/2019/07/visa_fler_ny.jpg
But if I go to the “View generated CSS” I get background-image: url(“http://dev.hamnen.se/wp-content/uploads/2019/07/visa_fler_ny.jpg”) So it is still pointing to the dev server.

Also when I try to change that and reload the CSS I get the error

Write stylesheet error
WordPress does not have “write” permission for: //wp-content/micro-themes/active-styles.css . Please see this help article for changing directory and file permissions: http://codex.wordpress.org/Changing_File_Permissions.Tip: you may want to jump to the “Using an FTP Client” section of the article. But bear in mind that if your web hosting runs windows it may not be possible to adjust permissions using an FTP program. You may need to log into your hosting control panel, or request that your host adjust the permissions for you.

So can that be the problem of the new transfered css file not taking effect?

Regards
Olle


olleka

Hi One more question if you have time…

When I’m logged in
I can see the right CSS
https://www.hamnen.se/wp-content/micro-themes/active-styles.css?nomtcache=1573463962&ver=c21fc1363f4681f0ab36881a5360bf16

But if I logout The CSS file is an old one
https://www.hamnen.se/wp-content/micro-themes/active-styles.css?mts=8888&ver=c21fc1363f4681f0ab36881a5360bf16

How can that be?


Sebastian

Hey Olle,

1. I think you should be able to solve this using relative paths. So instead of:

background-image: url(“http://dev.hamnen.se/wp-content/uploads/2019/07/visa_fler_ny.jpg”)

Use

background-image: url(“/wp-content/uploads/2019/07/visa_fler_ny.jpg”)

When you insert background images using MTs WP library feature, it uses relative paths in order to cater for setups like yours. Or did you in fact use the image insert button rather than entering the URL manually?

2. When you are logged in, MT uses the current time to ensure the most up to date file loads:

nomtcache=1573463962

This is circumventing your server cache.

But regular site visitors get the MT save count:

mts=8888

This number increases every time you make a change in Microthemer. And so under usual circumstances clears any cache for non-logged in site visitors. But because you are working on the dev site, the number isn’t incrementing on the live site, and stays at 8888. Your server has probably cached that URL. So you will need to manually clear the server cache after making local MT changes.

Does that make sense?

Thanks,
Sebastian


olleka

Thank you for the answer.
1. I’m using relative paths

2. Yes it makes sense. I just wonder two things. Since according to the server manager the server cache should be refreshed every 30 minutes. Does MT save the “save count” in the database? And if it is would it be a good idea to push the MT database table to the live site also?

And could it in any way be related to the
Write stylesheet error
WordPress does not have “write” permission for: //wp-content/micro-themes/active-styles.css .

Regards
Olle


Sebastian

Hey,

Your colleague emailed me and said “almost every folder and functionality will be locked for security reasons“. So that may be the cause of your WP write error.

The DB save count is stored in the database, in the wp_options table under the name:

preferences_themer_loader

(along with a bunch of other user preferences)

The current MT settings are also stored in the wp_options table under the name:

microthemer_ui_settings

Only revisions are stored in the wp_micro_revisions table, which is a separate table.

Cheers,
Sebastian


olleka

Aha sorry for the mail-bombing 🙂 Did not know that.

But like you said before. It should be enough to move jus the active.styles.CSS?
If the cache is refreshed properly in the live site.

Or should I also push the wp_options table to be sure?

Regards
Olle


Sebastian

I would try without updating the wp_options table, as it should work with a cache clear.

Cheers,
Sebastian


olleka

Ok. Thank you!
Many many thanks for the time spent about this issue!

Regards
Olle


Sebastian

You’re welcome 🙂

You must login or register to reply to this topic.