Created
May 7, 2012 20:09
-
-
Save mattroyer/2630077 to your computer and use it in GitHub Desktop.
Create a new Html5 document with a CoffeeScript command.
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
# Create a new Html5 document, by default called index.html | |
# If the user supplies a different name, it will use that | |
# name instead. | |
# | |
# Examples: | |
# C:\>coffee html.coffee | |
# => index.html | |
# File Created! | |
# | |
# C:\>coffee html.coffee myNewDoc.html | |
# => myNewDoc.html | |
# File Created! | |
fs = require 'fs' | |
html = ''' | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Title</title> | |
</head> | |
<body> | |
<div> | |
</div> | |
</body> | |
</html> | |
''' | |
file = process.argv | |
fs.writeFile file[2] or 'index.html', html, (err) -> | |
throw err if err | |
console.log "File created!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment