Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure plugin via define or json #222

Open
richard-unterberg opened this issue Oct 18, 2021 · 2 comments
Open

Configure plugin via define or json #222

richard-unterberg opened this issue Oct 18, 2021 · 2 comments

Comments

@richard-unterberg
Copy link

Hey guys, thanks for this awesome plugin. Using it daily in our wordpress instances.

It´s already possible to use define('WP_SCSS_ALWAYS_RECOMPILE', true); to force recompilation of files. Would be handy if we can define constants like "Base Location" or the "Paths" mounted in the parent / child theme files directly. So it becomes possible to save plugin configurations over git, etc

Configuration file (JSON) would be a neat alternative too.
If I find the time I will dig into this, but this can take a while.
Any shortcuts to this?

Thanks ✌️

@ermincelikovic
Copy link

What I do at the moment is following:

add_action( 'after_setup_theme', function() {
    $settings = array(
        "base_compiling_folder" => "Current Theme",
        "scss_dir" => "/assets/scss/",
        "css_dir" => "/assets/css/",
        "compiling_options" => "Leafo\ScssPhp\Formatter\Crunched",
        "sourcemap_options" => "SOURCE_MAP_FILE",
        "errors" => "show-logged-in"
    );

    update_option("wpscss_options", $settings);
});

Of course, you can change the action based on your needs.

@shadoath
Copy link
Collaborator

@richard-unterberg If you find the time we welcome a PR to improve this project.

@ermincelikovic thank you for adding the way to handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants