Created
November 23, 2012 07:57
-
-
Save meritt/4134442 to your computer and use it in GitHub Desktop.
Обновление версии для статики в шаблонах сайта
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(root, fn) -> | |
glob 'views/**/*.hbs', {}, (error, files) -> | |
for file in files | |
source = fs.readFileSync "#{root}/#{file}", 'utf8' | |
update = false | |
for filename, version of options.version | |
if source.indexOf(filename) > -1 | |
update = true | |
[name, extension] = filename.split '.' | |
source = source.replace filename, "#{name}.v#{version}.#{extension}" | |
if update is true | |
fs.writeFileSync "#{root}/#{file}", source | |
console.log "Update version for #{file}" | |
fn root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment