Sha256: 74cd76ddae013e6ff7eeced5ed44e5b29a57703248960ba54f9235e8afe3e728

Contents?: true

Size: 1.1 KB

Versions: 13

Compression:

Stored size: 1.1 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

/**
 * Creates new custom importers that use the given `resourcePath` if libsass calls the custom importer with `prev`
 * being 'stdin'.
 *
 * Why do we need this? We have to use the `data` option of node-sass in order to compile our sass because
 * the `resourcePath` might not be an actual file on disk. When using the `data` option, libsass uses the string
 * 'stdin' instead of a filename.
 *
 * We have to fix this behavior in order to provide a consistent experience to the webpack user.
 *
 * @param {Function|Array<Function>} importer
 * @param {string} resourcePath
 * @returns {Array<Function>}
 */
function proxyCustomImporters(importer, resourcePath) {
  return [].concat(importer).map( // eslint-disable-next-line no-shadow
  importer => function customImporter() {
    return importer.apply(this, // eslint-disable-next-line prefer-rest-params
    Array.from(arguments).map((arg, i) => i === 1 && arg === 'stdin' ? resourcePath : arg));
  });
}

var _default = proxyCustomImporters;
exports.default = _default;

Version data entries

13 entries across 11 versions & 6 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/@rails/webpacker/node_modules/sass-loader/dist/proxyCustomImporters.js
optimacms-0.1.61 spec/dummy/node_modules/sass-loader/dist/proxyCustomImporters.js
disco_app-0.18.0 test/dummy/node_modules/sass-loader/dist/proxyCustomImporters.js
disco_app-0.18.2 test/dummy/node_modules/sass-loader/dist/proxyCustomImporters.js
tang-0.2.1 spec/tang_app/node_modules/sass-loader/dist/proxyCustomImporters.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/sass-loader/dist/proxyCustomImporters.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/sass-loader/dist/proxyCustomImporters.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/sass-loader/dist/proxyCustomImporters.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/sass-loader/dist/proxyCustomImporters.js
tang-0.2.0 spec/tang_app/node_modules/sass-loader/dist/proxyCustomImporters.js
tang-0.1.0 spec/tang_app/node_modules/sass-loader/dist/proxyCustomImporters.js
tang-0.0.9 spec/tang_app/node_modules/sass-loader/dist/proxyCustomImporters.js
enju_library-0.3.8 spec/dummy/node_modules/sass-loader/dist/proxyCustomImporters.js