2016-09-21 37 views
0

有没有办法从Wordpress主题编辑器UI访问SCSS文件?我试着将它移动到根目录下,在我的style.css旁边,并将它留在SASS文件夹中。Wordpress中的SASS文件

我正在构建一个自定义主题,并已在本地运行SASS,现在要继续在Wordpress中进行开发。

+0

使用['wp_theme_editor_filetypes'](https://developer.wordpress.org/reference/hooks/wp_theme_editor_filetypes/)滤波器来添加SCSS/SASS作为文件扩展名。请注意,它仅适用于4.4及更高版本。 – naththedeveloper

回答

1

在编辑器中显示文件之前,您必须添加文件扩展名。你可以用wp_theme_editor_filetypes过滤器来做到这一点。

例如:

add_filter('wp_theme_editor_filetypes', function ($types) { 
    $types[] = 'scss'; 

    return $types; 
}); 
+0

谢谢!这很好。我如何将它编译到我的style.css中?没有一款sass编译器插件似乎可以与最新的WP版本一起使用。 – GrantW

+0

@GrantW问这是另一个问题。我不知道,对不起。 – naththedeveloper