File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 178178 "eslint-plugin-import" : " ^2.2.0" ,
179179 "eslint-plugin-jsx-a11y" : " ^4.0.0" ,
180180 "eslint-plugin-react" : " ^6.10.0" ,
181- "extract-text-webpack-plugin" : " 2.0.0-beta.5 " ,
181+ "extract-text-webpack-plugin" : " 2.1.0 " ,
182182 "file-loader" : " ^0.10.0" ,
183183 "font-awesome" : " ^4.7.0" ,
184184 "font-awesome-webpack" : " ^0.0.4" ,
Original file line number Diff line number Diff line change 1+ /**
2+ * @summary : The encoder function is capable to apply either incoming strings from webpack modules or objects.
3+ * @param loader
4+ * @returns {string }
5+ */
6+ function encodeLoader ( loader ) {
7+ if ( typeof loader === 'string' ) {
8+ return loader ;
9+ }
10+
11+ if ( typeof loader . options !== 'undefined' ) {
12+ const query = Object
13+ . keys ( loader . options )
14+ . map ( ( param ) => `${ encodeURIComponent ( param ) } =${ encodeURIComponent ( loader . options [ param ] ) } ` )
15+ . join ( '&' ) ;
16+ return `${ loader . loader } ?${ query } ` ;
17+ }
18+ return loader . loader ;
19+ }
20+
21+ /**
22+ * buildExtractStylesLoader can also deal with options without any trouble as
23+ * it converts them to query parameters if needed.
24+ */
25+ module . exports = function buildExtractStylesLoader ( loaders ) {
26+ const extractTextLoader = encodeLoader ( loaders [ 0 ] ) ;
27+ const fallbackLoader = encodeLoader ( loaders [ 1 ] ) ;
28+
29+ const restLoaders = loaders
30+ . slice ( 2 )
31+ . map ( ( loader ) => {
32+ if ( typeof loader === 'string' ) {
33+ return loader ;
34+ }
35+ return encodeLoader ( loader ) ;
36+ } ) ;
37+
38+ return [
39+ extractTextLoader ,
40+ fallbackLoader ,
41+ ...restLoaders ,
42+ ] . join ( '!' ) ;
43+ } ;
Original file line number Diff line number Diff line change 1+ const buildExtractStylesLoader = require ( './buildExtractStylesLoader' ) ;
12const fontAwesomeConfig = require ( './font-awesome.config.js' ) ;
23const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
3- fontAwesomeConfig . styleLoader = ExtractTextPlugin . extract ( {
4- fallbackLoader : 'style-loader' ,
5- loader : 'css-loader!less-loader'
6- } ) ;
4+
5+ /**
6+ * buildExtractStylesLoader can also deal with options without any trouble as
7+ * it converts them to query parameters if needed.
8+ */
9+ fontAwesomeConfig . styleLoader = buildExtractStylesLoader ( ExtractTextPlugin . extract ( {
10+ fallback : 'style-loader' ,
11+ use : [ 'css-loader' , 'less-loader' ] ,
12+ } ) ) ;
713module . exports = fontAwesomeConfig ;
You can’t perform that action at this time.
0 commit comments