Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Rodrigues committed May 14, 2012
1 parent acfe3f5 commit 7c33d05
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/replace_script_tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var fs = require('fs'),
path = require('path'),
srcFile = process.argv[2];

console.log('changing '+ srcFile);
if(!srcFile){
console.log('fail');
process.exit(1);
Expand All @@ -14,12 +15,15 @@ if(path.existsSync(path.dirname(srcFile)+'/../.git')){

fs.readFile(srcFile, 'utf-8', function(err, data) {
if(err) throw err;
console.log('replacing');
console.log(/<!--START-SCRIPT-TAGS(.|\s|\n)*END-SCRIPT-TAGS-->/g.exec(data));

data = data.replace(
/<!--START-SCRIPT-TAGS(.|\s|\n)*END-SCRIPT-TAGS-->/gm,
/<!--START-SCRIPT-TAGS(.|\s|\n)*END-SCRIPT-TAGS-->/g,
'<script src="assets/js/lxjs.min.js"></script>'
);

console.log('writing');
fs.writeFile(srcFile, data, 'utf-8', function(err) {
if(err) throw err;
console.log('file '+srcFile+' is ready');
Expand Down

0 comments on commit 7c33d05

Please sign in to comment.