本文整理汇总了PHP中scssc::setVariables方法的典型用法代码示例。如果您正苦于以下问题:PHP scssc::setVariables方法的具体用法?PHP scssc::setVariables怎么用?PHP scssc::setVariables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scssc
的用法示例。
在下文中一共展示了scssc::setVariables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_compiler
public function run_compiler($scss_dir, $sass_vars, $sass_import_file, $css_name, $compile_method = 'scss_formatter_nested')
{
require_once WPCSC_PLUGIN_DIR . '/scssphp/scss.inc.php';
$scss = new scssc();
$scss->setImportPaths($scss_dir);
$scss->setFormatter($compile_method);
$scss->setVariables($sass_vars);
$new_css = $scss->compile($sass_import_file);
/* Write the CSS to the Database */
$wpcscOptions = get_option('wpcsc1208_option_settings');
/* Sanitze the CSS before going into the Database
Refer to this doc, http://wptavern.com/wordpress-theme-review-team-sets-new-guidelines-for-custom-css-boxes */
$wpcscOptions['wpcsc_content'][$css_name] = wp_kses($new_css, array('\'', '\\"'));
update_option('wpcsc1208_option_settings', $wpcscOptions);
}
示例2: isset
*/
$primarycolor = isset($_POST['customize_ajax_ref_color_styles']) ? $_POST['customize_ajax_ref_color_styles'] : get_theme_mod('primary_color', '#3CBEFE');
// prove color
if (!preg_match('/#([a-f0-9]{3}){1,2}\\b/i', $primarycolor)) {
$primarycolor = '#3CBEFE';
}
/**
* Theme CSS Active
*/
$theme_css = isset($_POST['customize_ajax_ref_theme_styles']) ? intval($_POST['customize_ajax_ref_theme_styles']) : get_theme_mod('ref_theme_styles', 1);
/**
* Theme CSS Woo Active
*/
$theme_css_woo = isset($_POST['customize_ajax_ref_wc_styles']) ? intval($_POST['customize_ajax_ref_wc_styles']) : get_theme_mod('ref_wc_styles', 1);
$scss = new scssc();
$scss->setVariables(array("primarycolor" => $primarycolor));
$custom_css_theme = $custom_css_woo = '';
$custom_css = $scss->compile('
/********************************
* Color
**********************************/
a,
.text-primary,
.pagination > li > a, .pagination > li > span,
.btn-primary .badge,
.btn-link,
.list-group-item.active > .badge, .nav-pills > .active > a > .badge,
.panel-primary > .panel-heading .badge,
.wpt-taxonomy-popular-show-hide, .wpt-repadd,
{ color: $primarycolor; }
示例3: compile_bootstrap_css
function compile_bootstrap_css()
{
// Include the compiler class
require_once TEMPLATEPATH . '/inc/scssphp/scss.inc.php';
// Start new SCSS class
$scss = new scssc();
// Set the path where our SCSS files are located
$scss->setImportPaths(TEMPLATEPATH . "/css/scss/");
$scss->setFormatter('scss_formatter');
// Get all colors from the customizer
$cfColors = get_option('cf_colors');
// Overwrite any SASS variable we want!
$scss->setVariables($cfColors);
// Run the compiler with the new variables
$newCss = $scss->compile('
@import "bootstrap.scss";
');
//Find our current bootstrap file
$cssFile = TEMPLATEPATH . '/css/bootstrap.min.css';
$currentCss = file_get_contents($cssFile);
// Overwrite default bootstrap css with the newly compiled CSS
file_put_contents($cssFile, $newCss);
}