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

Broken wiring helpers #174

Closed
oxyc opened this issue Feb 17, 2013 · 1 comment
Closed

Broken wiring helpers #174

oxyc opened this issue Feb 17, 2013 · 1 comment
Labels

Comments

@oxyc
Copy link

oxyc commented Feb 17, 2013

I haven't tested but while browsing the code I noticed wiring.appendToFile() and wiring.prependToFile() uses wiring.writeFileFromString() with the arguments in the wrong order.

// Insert specific content as the last child of each element matched
// by the tagName selector. Writes to file.
wiring.appendToFile = function appendToFile(path, tagName, content) {
  var html = this.readFileAsString(path);
  var updatedContent = this.append(html, tagName, content);
  this.writeFileFromString(path, updatedContent);
};

// Insert specific content as the first child of each element matched
// by the tagName selector. Writes to file.
wiring.prependToFile = function prependToFile(path, tagName, content) {
  var html = this.readFileAsString(path);
  var updatedContent = this.prepend(html, tagName, content);
  this.writeFileFromString(path, updatedContent);
};

wiring.writeFileFromString = function writeFileFromString(html, filePath) {
   fs.writeFileSync(path.resolve(filePath), html, 'utf8');
};

source

@addyosmani
Copy link
Member

Good catch. We'll fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants