Skip to content

Commit

Permalink
Source maps ✨ (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop authored Mar 2, 2018
1 parent edbe0e4 commit ba78612
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const staticModule = require('static-module')
const from2 = require('from2-string')
const through = require('through2')
const assert = require('assert')
const d = require('defined')
const bl = require('bl')
const fs = require('fs')

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

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

assert.equal(typeof bundle, 'object', 'bundle should be an object')
assert.equal(typeof opts, 'object', 'opts should be an object')
Expand Down Expand Up @@ -46,7 +48,7 @@ function cssExtract (bundle, opts) {
writeStream.write(String(src) + '\n')
return from2('null')
}
})
}, { sourceMap: sourceMap })

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

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
"license": "MIT",
"dependencies": {
"bl": "^1.1.2",
"defined": "^1.0.0",
"from2-string": "^1.1.0",
"static-module": "^1.3.0",
"static-module": "^2.2.0",
"through2": "^2.0.1"
},
"devDependencies": {
Expand Down

0 comments on commit ba78612

Please sign in to comment.