Skip to content

Instantly share code, notes, and snippets.

@StanAngeloff
Created August 26, 2010 17:28
Show Gist options
  • Select an option

  • Save StanAngeloff/551817 to your computer and use it in GitHub Desktop.

Select an option

Save StanAngeloff/551817 to your computer and use it in GitHub Desktop.
options or= {}
target = "export/#{options.environment or 'production'}"
scripts = []
appContents = fs.readFileSync "#{target}/app-debug.html", 'utf8'
appContents = appContents.replace /[ \t]*<script type="text\/javascript" src="([^"]+)"><\/script>\n?/g, (line, filePath) ->
filePath = "lib/languages/#{options.language or 'en-GB'}/strings.js" if isLanguage = helpers.starts filePath, 'lib/languages/'
scripts.push fs.readFileSync "#{target}/#{filePath}", 'utf8'
return line.replace(filePath, "#{filePath}?#{timestamp}") if filePath is 'lib/app.js'
return ''
fs.writeFileSync "#{target}/app-debug.html", appContents, 'utf8'
fs.writeFileSync "#{target}/lib/app.uncompressed.js", scripts.join('\n\n'), 'utf8'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment