Skip to content

Commit ba78612

Browse files
Source maps ✨ (#14)
1 parent edbe0e4 commit ba78612

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const staticModule = require('static-module')
22
const from2 = require('from2-string')
33
const through = require('through2')
44
const assert = require('assert')
5+
const d = require('defined')
56
const bl = require('bl')
67
const fs = require('fs')
78

@@ -13,6 +14,7 @@ function cssExtract (bundle, opts) {
1314
opts = opts || {}
1415

1516
var outFile = opts.out || opts.o || 'bundle.css'
17+
var sourceMap = d(opts.sourceMap, bundle && bundle._options && bundle._options.debug, false)
1618

1719
assert.equal(typeof bundle, 'object', 'bundle should be an object')
1820
assert.equal(typeof opts, 'object', 'opts should be an object')
@@ -46,7 +48,7 @@ function cssExtract (bundle, opts) {
4648
writeStream.write(String(src) + '\n')
4749
return from2('null')
4850
}
49-
})
51+
}, { sourceMap: sourceMap })
5052

5153
source.pipe(sm).pipe(bl(complete))
5254

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
"license": "MIT",
2222
"dependencies": {
2323
"bl": "^1.1.2",
24+
"defined": "^1.0.0",
2425
"from2-string": "^1.1.0",
25-
"static-module": "^1.3.0",
26+
"static-module": "^2.2.0",
2627
"through2": "^2.0.1"
2728
},
2829
"devDependencies": {

0 commit comments

Comments
 (0)