Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 648 Bytes

browserify-string.coffee.md

File metadata and controls

22 lines (17 loc) · 648 Bytes

This is a modified version of browserify-string. Basically it is pull request #5.

browserify = require 'browserify'
path = require 'path'
{Readable} = require 'stream'

module.exports = ( str, opts ) ->
  if typeof str is 'function'
    str = [
      '('
      str.toString()
      ')();'
    ].join '\n'

  opts.basedir ?= process.cwd()

  stream = new Readable()
  stream.push str
  stream.push null

  browserify stream, opts