File tree Expand file tree Collapse file tree 4 files changed +29
-17
lines changed
Expand file tree Collapse file tree 4 files changed +29
-17
lines changed Original file line number Diff line number Diff line change @@ -92,15 +92,13 @@ Example:
9292
9393### extract-text-webpack-plugin
9494
95- Configure post style loaders in ` font-awesome.config.js ` .
95+ Configure style loader in ` font-awesome.config.js ` .
9696
9797Example:
9898
9999``` javascript
100100module .exports = {
101- postStyleLoaders: [
102- require .resolve (' extract-text-webpack-plugin/loader.js' ) + ' ?{"omit":1,"extract":true,"remove":true}'
103- ],
101+ styleLoader: require (' extract-text-webpack-plugin' ).extract (' style-loader' , ' css-loader!less-loader' ),
104102 styles: {
105103 ...
106104 }
Original file line number Diff line number Diff line change 11module . exports = {
2+ // Default for the style loading
3+ styleLoader : 'style-loader!css-loader!less-loader' ,
4+
25 styles : {
36 'mixins' : true ,
47 'bordered-pulled' : true ,
Original file line number Diff line number Diff line change 11module . exports = function ( ) {
22} ;
3- module . exports . pitch = function ( remainingRequest ) {
4- this . cacheable ( true ) ;
5- var config = require ( this . resourcePath ) ;
6- var postStyleLoaders = '' ;
7- if ( ( typeof config . postStyleLoaders !== 'undefined' ) && ( config . postStyleLoaders . length > 0 ) ) {
8- postStyleLoaders = config . postStyleLoaders . join ( '!' ) + '!' ;
9- }
10- return [
11- 'require(' + JSON . stringify ( "-!" + postStyleLoaders + require . resolve ( "style-loader" ) + '!' + require . resolve ( "css-loader" ) +
12- '!' + require . resolve ( "less-loader" ) + '!' + require . resolve ( "./font-awesome-styles.loader.js" ) + '!' + remainingRequest ) + ');'
13- ] . join ( "\n" ) ;
14- } ;
3+
4+ module . exports . pitch = function ( remainingRequest ) {
5+
6+ // Webpack 1.7.3 uses this.resourcePath. Leaving in remaining request for possibly older versions
7+ // of Webpack
8+ var configFilePath = this . resourcePath || remainingRequest ;
9+ this . cacheable ( true ) ;
10+
11+ if ( ! configFilePath || configFilePath . trim ( ) === '' ) {
12+ var msg = 'You specified the font-awesome-webpack with no configuration file. Please specify' +
13+ ' the configuration file, like: \'font-awesome-webpack!./font-awesome.config.js\' or use' +
14+ ' require(\'font-awesome-webpack\').' ;
15+ console . error ( 'ERROR: ' + msg ) ;
16+ throw new Error ( msg ) ;
17+ }
18+
19+ var config = require ( configFilePath ) ;
20+ var styleLoader = config . styleLoader || 'style-loader!css-loader!less-loader' ;
21+
22+ var styleLoaderCommand = 'require(' + JSON . stringify ( '-!' + styleLoader + '!' +
23+ require . resolve ( './font-awesome-styles.loader.js' ) + '!' + configFilePath ) + ');' ;
24+ return styleLoaderCommand ;
25+ } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " font-awesome-webpack" ,
3- "version" : " 0.0.3 " ,
3+ "version" : " 0.0.4 " ,
44 "description" : " font-awesome package for webpack" ,
55 "main" : " index.js" ,
66 "loader" : " index.loader.js" ,
You can’t perform that action at this time.
0 commit comments