forked from delemaf/font-awesome-webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.loader.js
25 lines (20 loc) · 984 Bytes
/
index.loader.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module.exports = function() {
};
module.exports.pitch = function (remainingRequest) {
// Webpack 1.7.3 uses this.resourcePath. Leaving in remaining request for possibly older versions
// of Webpack
var configFilePath = this.resourcePath || remainingRequest;
this.cacheable(true);
if (!configFilePath || configFilePath.trim() === '') {
var msg = 'You specified the font-awesome-webpack with no configuration file. Please specify' +
' the configuration file, like: \'font-awesome-webpack!./font-awesome.config.js\' or use' +
' require(\'font-awesome-webpack\').';
console.error('ERROR: ' + msg);
throw new Error(msg);
}
var config = require(configFilePath);
var styleLoader = config.styleLoader || 'style-loader!css-loader!less-loader';
var styleLoaderCommand = 'require(' + JSON.stringify('-!' + styleLoader + '!' +
require.resolve('./font-awesome-styles.loader.js') + '!' + configFilePath) + ');';
return styleLoaderCommand;
};