| 1 |
// tools/node-sass-compat/index.js |
| 2 |
const sass = require('sass'); |
| 3 |
|
| 4 |
function translate(options = {}) { |
| 5 |
const { outputStyle, ...rest } = options; |
| 6 |
// node-sass の値 → dart-sass の値へマッピング |
| 7 |
const style = |
| 8 |
outputStyle === 'nested' || outputStyle === 'compact' |
| 9 |
? 'expanded' |
| 10 |
: outputStyle === 'compressed' |
| 11 |
? 'compressed' |
| 12 |
: rest.style; |
| 13 |
|
| 14 |
return { ...rest, style }; |
| 15 |
} |
| 16 |
|
| 17 |
exports.render = (opts, cb) => sass.render(translate(opts), cb); |
| 18 |
exports.renderSync = (opts) => sass.renderSync(translate(opts)); |
| 19 |
// 雑に info を返す(node-sass 互換で参� |
| 20 |
�されることがある) |
| 21 |
exports.info = `node-sass-compat (dart-sass ${sass.info || ''})`; |
| 22 |
|