Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Commit

Permalink
The module version of fuse is now working again.
Browse files Browse the repository at this point in the history
  • Loading branch information
smebberson committed Dec 9, 2013
1 parent a31b9c9 commit 2f6191c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/fuse.js
Expand Up @@ -303,6 +303,12 @@ Fuse.prototype.fuseFile = function (inputFile, outputFile) {
// core function for parsing and generating output for a file
Fuse.prototype.fuseContent = function (content, relativePath, mode) {

// what mode are we running in, HTML or JS?
// this needs to be improved, because it means it will only work if the file ext is 'html' || 'js'
this.mode = mode;
// swtich the regular expression based on mode
this.regex = (this.mode === 'js') ? this.reJS : this.reHTML;

// grab a list of the referenced files
var matches = this.getReferencedFiles(content, this.regex),
// output is a version of the content that we'll update
Expand All @@ -312,7 +318,7 @@ Fuse.prototype.fuseContent = function (content, relativePath, mode) {
// do we have anything to combine?
if (!matches.length) return this.emit('nofuse');

this.fuse(content, matches, relativePath, this.mode, function (err, results) {
this.fuse(content, matches, relativePath, function (err, results) {

if (err) {
return _this.emit('error', err);
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -15,7 +15,7 @@ exports.fuseContent = function (content, relativePath, mode, callback) {
// check we have a path
if (!relativePath.length) return callback(new Error('No relative path was supplied.'));

fuser = new Fuse();
fuser = new fuse.Fuse();

fuser.on('fuse', function (results) {
callback(null, results);
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Expand Up @@ -235,7 +235,7 @@ describe('Using fuse', function () {

fuse.fuseContent(content, path.resolve(__dirname, 'module', 'depends'), 'html', function (err, result) {

assert.equal(expected, result);
assert.equal(expected, result.updated);

done(err);

Expand Down

0 comments on commit 2f6191c

Please sign in to comment.