@alifd/sass-mapper
v3.0.1
Published
sass mapper
Downloads
61
Readme
sass-mapper
sass变量映射器
Installation
$ npm install @no-repeat/sass-mapper --save
Node.js >= 8.0.0 required. Sass compiled with dart2js 2.0.0 required.
Getting Started
const sassMapper = require('@no-repeat/sass-mapper');
async function getSassVarMap(merged) {
const sources = {
'core.scss': fs.readFileSync(path.join(__dirname, 'assets/core.scss'), 'utf8'),
'button.scss': fs.readFileSync(path.join(__dirname, 'assets/button.scss'), 'utf8'),
};
/**
* @param {String} entry的name
* @param {Object} 所有entry的集合
* @param {String} 需要映射class的sass变量的前缀
* @return {Object} {selectors: [], vars: {}}
*/
const sassVarMap = await sassMapper('button.scss', sources, '$btn-');
return sassVarMap;
}