File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " css-with-mapping-loader" ,
3
3
"description" : " css to string with source mapping loader for webpack" ,
4
- "version" : " 0.0.1 " ,
4
+ "version" : " 0.0.2 " ,
5
5
"main" : " ./src/css-with-mapping.js" ,
6
6
"author" : {
7
7
"name" : " Zhicheng Wang" ,
Original file line number Diff line number Diff line change 1
1
/**
2
2
* @see https://webpack.github.io/docs/loaders.html
3
3
*/
4
- module . exports = function ( content ) {
4
+ module . exports = function ( script ) {
5
+ var content = this . exec ( script , __filename ) ;
5
6
if ( ! content || content . length !== 1 ) {
6
- throw new Error ( 'The css-with-mapping-loader must be chained after the css-loader' ) ;
7
+ throw new Error ( 'The css-with-mapping-loader must be chained after the css-loader\n' + content ) ;
7
8
}
8
9
var cssObject = content [ 0 ] ;
9
10
var cssContent = cssObject [ 1 ] || '' ;
@@ -16,5 +17,5 @@ module.exports = function (content) {
16
17
var sourceURLs = cssMapping . sources . map ( function ( source ) {
17
18
return '/*# sourceURL=' + cssMapping . sourceRoot + source + ' */'
18
19
} ) ;
19
- return [ cssContent ] . concat ( sourceURLs ) . concat ( [ sourceMapping ] ) . join ( '\n' ) ;
20
- } ;
20
+ return 'module.exports = ' + JSON . stringify ( [ cssContent ] . concat ( sourceURLs ) . concat ( [ sourceMapping ] ) . join ( '\n' ) ) ;
21
+ } ;
You can’t perform that action at this time.
0 commit comments