📃 Browserify inline script tags in HTML
JavaScript HTML
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore initial commit Jun 13, 2013
README.md Update changelog Mar 23, 2015
example.js initial commit Jun 13, 2013
index.html initial commit Jun 13, 2013
index.js BUG: will skip external sources Mar 22, 2015
package.json Release v1.0.0. Mar 23, 2015
test.js initial commit Jun 13, 2013



Browserify inline script tags in HTML.


We have a index.html page with:

<!doctype html>
<html lang="en">
  <script type="text/browserify">
  var radical = require('./rad.js')

Then as we serve the HTML we can transform it:

var scriptify = require('scriptify')

// Bundle an HTML file

// Or bundle as the server requests it:
var http = require('http')
var fs = require('fs')
http.createServer(function(req, res) {
  if (req.url !== '/') return res.end('')
  res.writeHead(200, {'Content-Type': 'text/html'})
console.log('Server running at http://localhost:8080/')


Returns a Stream.

  • options:
    • selector: Defaults to script[type="text/browserify"].
    • args: Defaults to []. Arguments to pass to browserify.

Is this a good idea?

I don't know. Probably not. I'm just being lazy and sometimes don't want to have a separate file for an entry point.


With npm do:

npm install scriptify

release history

  • 1.0.0 - Skip external sources. (@karissa)
  • 0.2.0 - Use script src attribute if available. Upgrade browserify and cheerio. (@maxogden)
  • 0.1.0 - initial release


Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.