I am using [cde] to change the JS inside a theme I am building, like so:

wp_localize_script();

Although this is good, the way in which this works could it be creates inline JS before the JS file under consideration loads, that method for you to use certain variables to change the JS and just how it truely does work.

Issue is, I do not enjoy this method and just how it results inline JS. Does anybody are conscious of an alternative choice to this? I am confident this is not how everybody performs this using their theme options so there has to be one other way.

Any help whatsoever could be appreciated, please no links to plug ins either.

In a nutshell: I am searching for an alternative choice to using wp_enqueue_script('custom', get_bloginfo('template_directory') . '/js/script.js'); $settings = get_option('bro_options'); wp_localize_script('custom','settings',$settings); or an easy method of utilizing it.

Things I did was produce a file known as wp_localize_script(); and for the reason that I incorporated the settings.js.php file.

Like so:

wp-config.php

Which may output my options inside a variable such as this:

<?php

    header("Content-type: application/x-javascript");

    $c = 0;

    while($exists !== true && $notfound !== true) {

        $c++;
        $str = $str . '../';

        if(file_exists($str.'wp-config.php')) {
            $exists = true;
            include($str.'wp-config.php');

            $i = 0;
            $amount = sizeof($bro);

            echo 'var settings={';
            foreach($bro as $key => $value) {
                $i++;
                if($i<$amount) {
                    echo $key . ':"' . $value . '",';
                } else {
                    echo $key . ':"' . $value . '"';
                }
            }
            echo '};';

        }

        if($c === 20) { 
            $notfound = true;
        }

    }

?>

I'd enqueue this file before my var settings = { foo: true, bar: false }; file this way I possibly could determine whether some configurations were off and on.

custom.js

All of this and so i do not have inline JS, there might be some cache issues but I'd favour that of computer output all options inline.