Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated browserify version #112

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions lib/modules/browserify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@ class exports.BrowserifyAsset extends Asset
@require = options.require
@debug = options.debug or false
@compress = options.compress
@external = options.external
@transform = options.transform
@compress ?= false
@extensionHandlers = options.extensionHandlers or []
agent = browserify watch: false, debug: @debug
for handler in @extensionHandlers
agent.register(handler.ext, handler.handler)
agent.addEntry @filename
agent.require @require if @require
if @compress is true
uncompressed = agent.bundle()
@contents = uglify.minify(uncompressed, {fromString: true}).code
@emit 'created'
else
@emit 'created', contents: agent.bundle()
agent.add @filename if @filename

if @require
for r in @require
if r.file
agent.require r.file, r.options
else
agent.require r

agent.external ext for ext in @external if @external
agent.transform t for t in @transform if @transform

agent.transform 'coffeeify' if /.coffee$/.test @filename

agent.bundle (error, src) =>
return @emit 'error', error if error?
if @compress is true
@contents = uglify.minify(src, {fromString: true}).code
@emit 'created'
else
@emit 'created', contents: src
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Brad Carleton <[email protected]>",
"repository": "https://github.com/techpines/asset-rack",
"dependencies": {
"browserify": "1.17.3",
"browserify": "~2.34.0",
"snockets": "~1.3.8",
"uglify-js": "~2.4.0",
"async": "~0.2.9",
Expand All @@ -17,6 +17,7 @@
"stylus": "~0.38.0",
"underscore": "~1.5.2",
"coffee-script": "~1.6.3",
"coffeeify": "~0.5.0",
"markdown": "~0.5.0",
"node-sassy": "~0.0.1"
},
Expand Down