index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _less = require('less');
  6. var _less2 = _interopRequireDefault(_less);
  7. var _pify = require('pify');
  8. var _pify2 = _interopRequireDefault(_pify);
  9. var _processResult = require('./processResult');
  10. var _processResult2 = _interopRequireDefault(_processResult);
  11. var _getOptions = require('./getOptions');
  12. var _getOptions2 = _interopRequireDefault(_getOptions);
  13. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14. var render = (0, _pify2.default)(_less2.default.render.bind(_less2.default));
  15. function lessLoader(source) {
  16. var loaderContext = this;
  17. var options = (0, _getOptions2.default)(loaderContext);
  18. var done = loaderContext.async();
  19. var isSync = typeof done !== 'function';
  20. if (isSync) {
  21. throw new Error('Synchronous compilation is not supported anymore. See https://github.com/webpack-contrib/less-loader/issues/84');
  22. }
  23. (0, _processResult2.default)(loaderContext, render(source, options));
  24. }
  25. exports.default = lessLoader;