Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Only recompile sass when in dev mode.
- # This block also handles the minification of CSS and JS.
- if ($config['dev']) {
- $scss = new \Leafo\ScssPhp\Compiler();
- $scss->setImportPaths(dirname(__FILE__) . '/assets/scss/');
- foreach (glob(dirname(__FILE__) . '/assets/scss/' . '**/*', GLOB_ONLYDIR) as $path)
- $scss->addImportPath($path);
- $scss->setFormatter('\Leafo\ScssPhp\Formatter\Crunched');
- $css = $scss->compile(file_get_contents(dirname(__FILE__) . '/assets/scss/style.scss'));
- file_put_contents(dirname(__FILE__) . '/style.css', \Theme\Utils::cssHeader() . $css);
- $js = new \Theme\Js($config['js']);
- file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'script.js', $js->minify());
- }
- # Enqueue the minified JS.
- wp_enqueue_script('js-minified', get_stylesheet_directory_uri() . DIRECTORY_SEPARATOR . 'script.js', array(), null, true);
- # Enqueue the minified CSS.
- wp_enqueue_style('css-minified', get_stylesheet_directory_uri() . DIRECTORY_SEPARATOR . 'style.css', [], null, 'all');
- wp_enqueue_style('font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', [], null, 'all');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement