Permalink
Browse files

Work on both .js and .coffee files

  • Loading branch information...
1 parent 6eae241 commit 4116b2fbf71aa1bc10f12879fd97f5da703db210 @jnordberg committed Jan 22, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 plugin.coffee
View
7 plugin.coffee
@@ -2,14 +2,17 @@
browserify = require 'browserify'
path = require 'path'
+stripExtension = (filename) ->
+ filename.replace /(.+)\.[^.]+$/, '$1'
+
module.exports = (wintersmith, callback) ->
class BrowserifyPlugin extends wintersmith.ContentPlugin
constructor: (@_filename, @_base) ->
getFilename: ->
- @_filename
+ "#{ stripExtension @_filename }.js"
render: (locals, contents, templates, callback) ->
bundle = browserify
@@ -31,5 +34,5 @@ module.exports = (wintersmith, callback) ->
BrowserifyPlugin.fromFile = (filename, base, callback) ->
callback null, new BrowserifyPlugin filename, base
- wintersmith.registerContentPlugin 'scripts', '**/*.js', BrowserifyPlugin
+ wintersmith.registerContentPlugin 'scripts', '**/*.*(js|coffee)', BrowserifyPlugin
callback()

0 comments on commit 4116b2f

Please sign in to comment.