JSPM

rwm-sass-compilation

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 71
  • Score
    100M100P100Q10131F
  • License MIT

Centralized SCSS compilation for WordPress themes.

Package Exports

  • rwm-sass-compilation
  • rwm-sass-compilation/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rwm-sass-compilation) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rwm-sass-compilation

Centralize SCSS compilation for WordPress projects that ship multiple themes. This package discovers each theme's assets, compiles the SCSS sources, and writes the resulting CSS without the need to wire a separate build step per theme.

Installation

npm install --save-dev rwm-sass-compilation

The CLI is also exposed via npx:

npx rwm-sass compile

Expected structure

Each theme should live inside a common root directory (for example wp-content/themes). Within every theme, the package looks for the following paths:

<theme>/
  assets/
    sass/          # SCSS entry files (partials prefixed with "_" are ignored)
    stylesheets/   # Destination for compiled CSS files

CLI usage

rwm-sass [command] [options]

Commands

  • compile (default) – compile SCSS for the matched themes once.
  • watch – compile themes and stay active to recompile when changes occur.

Common options

Option Description Default
--root <path> Directory containing theme folders. process.cwd()
--themes <names> Comma-separated list of theme folder names to include. All directories in root.
--sass-dir <path> Relative SCSS source directory inside each theme. assets/sass
--css-dir <path> Relative CSS output directory inside each theme. assets/stylesheets
`--style <expanded compressed>` Sass output style.
--include-path <path> Extra include path for Sass imports (repeatable).
--source-map Emit .map files alongside compiled CSS. Disabled
--watch, -w Enable watch mode after the initial compile. Disabled
--silent, -s Suppress info logs (warnings and errors still print). Disabled

Examples

Compile every theme under wp-content/themes:

rwm-sass compile --root wp-content/themes

Compile only specific themes:

rwm-sass compile --root wp-content/themes --themes theme-one,theme-two

Watch a theme and emit source maps:

rwm-sass watch --root wp-content/themes --themes theme-one --source-map

Programmatic API

You can also orchestrate compilation from Node.js:

const { compileAllThemes, watchThemes } = require('rwm-sass-compilation');

await compileAllThemes({
  root: 'wp-content/themes',
  themes: ['my-theme'],
  sourceMap: true
});

watchThemes(options) resolves once the initial compilation finishes and returns { watchers }, where watchers is an array of the active chokidar instances.

License

MIT