Skip to content
Browse files

v0.0.2, ready for npm

  • Loading branch information...
1 parent f71c2b8 commit 60d381cea366b35d2ecb1df64384b45d8dfa5bba @brandonbloom committed Sep 5, 2011
Showing with 42 additions and 14 deletions.
  1. +16 −0 bin/html2coffeekup
  2. +1 −6 html2coffeekup.coffee → lib/converter.coffee
  3. +17 −6 package.json
  4. +8 −2 readme.md
View
16 bin/html2coffeekup
@@ -0,0 +1,16 @@
+#!/usr/bin/env coffee
+
+path = require 'path'
+fs = require 'fs'
+
+
+if process.argv.length < 3
+ console.log "Usage: #{path.basename(__filename)} <html-file>"
+ process.exit 1
+
+
+lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib')
+{Converter} = require "#{lib}/converter"
+
+html = fs.readFileSync process.argv[2], 'utf8'
+new Converter().convert(html)
View
7 html2coffeekup.coffee → lib/converter.coffee
@@ -1,13 +1,12 @@
{inspect} = require 'util'
htmlparser = require 'htmlparser'
-{readFileSync} = require 'fs'
stringLiteral = (html) ->
inspect html.trim()
-class Converter
+class exports.Converter
constructor: ->
@depth = 0
@@ -90,7 +89,3 @@ class Converter
visitStyle: (style) ->
@visitTag style #TODO: Something better
-
-
-html = readFileSync process.argv[2], 'utf8'
-new Converter().convert(html)
View
23 package.json
@@ -1,13 +1,24 @@
{
"name": "html2coffeekup",
- "author": "Brandon Bloom <brandon@brandonbloom.name>",
"description": "Converts HTML to Coffeekup markup",
- "version": "0.0.1",
- "dependencies": {
- "htmlparser": ">= 1.7.3"
+ "author": "Brandon Bloom <brandon@brandonbloom.name>",
+ "version": "0.0.2",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/brandonbloom/html2coffeekup.git"
},
- "devDependencies": {
+ "keywords": [
+ "coffeekup"
+ ],
+ "bin": {
+ "html2coffeekup": "./bin/html2coffeekup"
+ },
+ "dependencies": {
+ "htmlparser": ">= 1.7.3",
"coffee-script": ">= 1.1.1"
},
- "engines": {"node": ">= 0.4.7"}
+ "engines": {
+ "node": ">= 0.4.7"
+ },
+ "license": "BSD"
}
View
10 readme.md
@@ -1,9 +1,15 @@
-Barely functional and not pretty to use, but here it is in action.
+Not fully complete, but still a huge time saver. Tested on dozens of files that only needed minor touch ups after conversion.
+
+# Installation
+
+```
+npm install -g html2coffeekup
+```
# Usage
```
-$ coffee html2coffeekup.coffee test/simple.html
+html2coffeekup test/simple.html
```
# Output

0 comments on commit 60d381c

Please sign in to comment.
Something went wrong with that request. Please try again.