modify-vars.js 703 B

12345678910111213141516171819202122232425262728
  1. var less;
  2. // Dist fallback for NPM-installed Less (for plugins that do testing)
  3. try {
  4. less = require('../tmp/less.cjs.js');
  5. }
  6. catch (e) {
  7. less = require('../dist/less.cjs.js');
  8. }
  9. var fs = require('fs');
  10. var input = fs.readFileSync('./test/less/modifyVars/extended.less', 'utf8');
  11. var expectedCss = fs.readFileSync('./test/css/modifyVars/extended.css', 'utf8');
  12. var options = {
  13. modifyVars: JSON.parse(fs.readFileSync('./test/less/modifyVars/extended.json', 'utf8'))
  14. };
  15. less.render(input, options, function (err, result) {
  16. if (err) {
  17. console.log(err);
  18. }
  19. if (result.css === expectedCss) {
  20. console.log('PASS');
  21. } else {
  22. console.log('FAIL');
  23. }
  24. });