Where does Microthemer stores it's CSS and selectors?

Author Posts

adkoen

Hi Sebastian,

When working/updating a website on a local install, do I need to copy over the database to move over the CSS and selectors generated by Microthemer? Or is it enough to copy over the folder where all the css/scss is written to files?

Reason for asking, just want to know the inners when pulling such a website locally and make some edits. Maybe it’s not necessary to pull the database too. I would be a bit easier for websites that have a lot going on. I do understand the Microthemer settings are stored in the database. That’s no problem.

And one more thing, any idea if I could call a function from my own plugin and have Microthemer save and compile the scss file to css? The same actually as when you hit save when working with Microthemer.

Thanks!!!
best,
Koen.


Sebastian

Hey Koen,

Microthemer’s style settings and workspace settings are stored in the wp_options table. Look for the following option_name keys:

microthemer_ui_settings (style settings)
preferences_themer_loader (workspace settings)

Revision history is stored in a dedicated table: wp_micro_revisions

I recommend copying the database as well to avoid surprising behaviour. MT expects settings to exist in the DB, and so I foresee potential problems. Although I can’t predict exactly what would happen right now.

Micorthemer uses the following SCSSPHP library to compile SCSS to SCSS: http://leafo.github.io/scssphp/docs/

So you could just install that yourself somewhere and then include the library where you need it. Here is some sample code to help you get started:

include 'your-path-to/scss.inc.php'; // this could be MT's file, but the directory changes from time to time
use Leafo\ScssPhp;
$scss = new Leafo\ScssPhp\Compiler();
$scss->setFormatter('Leafo\ScssPhp\Formatter\Expanded');
$scss->setImportPaths('your-chosen-directory-where-scss-files-are-stored');
$scss_code = '$color: red; p { color: $color; }';
$compiled_css = $scss->compile($scss_code);

I hope that helps!

Cheers,
Sebastian


adkoen

Yep, it sure helps 🙂
You mention the path to MT’s scss file, that the directory could change from time to time? Does that mean you won’t stick to your current implementation about the location of the Microthemer CSS files?
thanks.


Sebastian

No, I just change the name of the library folder to signal when it was last updated. This isn’t strictly necessary. I could flag this some other way if you want to tap into MTs version of SCSSPHP? The import path will always be /wp-content/micro-themes/

You must login or register to reply to this topic.