diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-07-22 17:01:57 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-07-22 17:07:29 +0300 |
commit | bc3f33f92a16d3afdb8a472f60940e7c46a31564 (patch) | |
tree | c6e568504b7888591ad15586bb1ace99db8941ca /coffee-asset-pipeline-comments.js | |
parent | 033e5423a2594e08a7ebcd2379bd2331f4c39032 (diff) | |
download | gitlab-ce-jsify.tar.gz |
JSify all the things!jsify
Diffstat (limited to 'coffee-asset-pipeline-comments.js')
-rw-r--r-- | coffee-asset-pipeline-comments.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/coffee-asset-pipeline-comments.js b/coffee-asset-pipeline-comments.js new file mode 100644 index 00000000000..67bf40b0321 --- /dev/null +++ b/coffee-asset-pipeline-comments.js @@ -0,0 +1,37 @@ +var fs = require('fs'), + os = require('os'), + lineReader = require('line-reader'); + +function help(){ + console.log('Usage: node coffee-asset-pipeline-comments.js file1.coffee'); +} + +function compilefile(pathname, outdir){ + var src = ''; + + lineReader.eachLine(pathname, function(line, last) { + // asset pipeline comments + if ( line.indexOf('#') === 0 && line.indexOf('=') === 1) { + line = line.replace('#', ''); + line = '###' + line + ' ###'; + } + src += line; + src += os.EOL; + + if ( last ) { + fs.writeFile(pathname, src); + } + }); +} + +function main(){ + if (process.argv.length <=2){ + help(); + return; + } + + console.log('Compiling: '+ process.argv[2]); + compilefile(process.argv[2]); +} + +main(); |