UNPKG

vux-loader-ig

Version:

extended loader for vue-loader && solve path of vux components

19 lines (18 loc) 583 B
'use strict' const fs = require('fs') module.exports = function getLessVariables(theme) { var themeContent = fs.readFileSync(theme, 'utf-8') var variables = {} themeContent.split('\n').forEach(function (item) { if (item.indexOf('//') > -1 || item.indexOf('/*') > -1) { return } var _pair = item.split(':') if (_pair.length < 2) return; var key = _pair[0].replace('\r', '').replace('@', '') if (!key) return; var value = _pair[1].replace(';', '').replace('\r', '').replace(/^\s+|\s+$/g, '') variables[key] = value }) return variables }