Although not structured entirely the same as the Less Theme Support plugin, which uses add_theme_support, the WP-SCSS plugin provides a decent Sass counterpart.
WP-SCSS compiles Sass using scssphp, a compiler script written in PHP. When changes are made to the SCSS files, the plugin compiles them to the matching CSS file. If a matching CSS file doesn’t exist, the plugin will create one.
Paths to the SCSS and CSS files can be configured in the plugin’s settings page (defined relative to your theme folder), along with error reporting, compiling options, and auto enqueuing.
The best way to ensure the most accurate compiling is to have separate SCSS and CSS directories in your theme’s folder, i.e.:
You’ll have three different modes as options for compiling when using the plugin:
- Expanded – Full open CSS. One line per property. Brackets close on their own line.
- Nested – Lightly compressed CSS. Brackets close with CSS block. Indents to match SCSS nesting.
- Compressed – Fully compressed CSS.
The auto enqueuing should be used with care, because if you ever disable the plugin your CSS files will no longer be enqueued. By default, the automatic enqueuing will enqueue all the files found in the CSS directory that you define in the plugin’s settings, including any non-compiled CSS files that you may have in play. Obviously, if you utilize the plugin’s auto enqueuing feature, you should make sure that you’re not reenqueing them somewhere else.
The WP-SCSS plugin makes using Sass in your WordPress themes a more convenient possibility. It provides limited Compass and/or Bourbon support as well as a way to use @import subfiles. Refer to the FAQ tab on the plugin’s WordPress.org homepage for more information and troubleshooting tips.