Permalink
Browse files

fix stupid indenting

  • Loading branch information...
1 parent adb9e92 commit 7760eb61ceb3194359a9a975a21ae26dda42bdd4 @contra contra committed Mar 14, 2012
Showing with 39 additions and 39 deletions.
  1. +23 −23 bin/jaded
  2. +16 −16 lib/main.coffee
View
@@ -7,12 +7,12 @@ program = require 'commander'
mkdirp = require 'mkdirp'
program
- .version('0.0.1')
- .option('-i --input [folder]', 'Specify input folder', '.')
- .option('-o --output [folder]', 'Specify output folder', '.')
- .option('-d --development', 'Beautify output and insert line numbers')
- .option('-a --amd', 'Wrap output in AMD closure')
- .parse(process.argv)
+ .version('0.0.1')
+ .option('-i --input [folder]', 'Specify input folder', '.')
+ .option('-o --output [folder]', 'Specify output folder', '.')
+ .option('-d --development', 'Beautify output and insert line numbers')
+ .option('-a --amd', 'Wrap output in AMD closure')
+ .parse(process.argv)
indir = join process.cwd(), program.input
outdir = join process.cwd(), program.output
@@ -22,26 +22,26 @@ throw 'Invalid input folder' unless lstatSync(indir).isDirectory()
throw 'Invalid output folder' unless lstatSync(outdir).isDirectory()
opt =
- development: program.development
- amd: program.amd
+ development: program.development
+ amd: program.amd
count = 0
renderFolder = (folder, output) ->
- files = readdirSync folder
- for file in files
- file = join folder, file
- stat = lstatSync file
- if stat.isDirectory()
- console.log basename file
- renderFolder file, join output, basename file
- else
- return unless extname(file) is '.jade'
- name = basename file, extname file
- savepath = join output, "#{name}.js"
- contents = String readFileSync file
- newcontents = jaded.compile contents, opt
- writeFileSync savepath, newcontents
- ++count
+ files = readdirSync folder
+ for file in files
+ file = join folder, file
+ stat = lstatSync file
+ if stat.isDirectory()
+ console.log basename file
+ renderFolder file, join output, basename file
+ else
+ return unless extname(file) is '.jade'
+ name = basename file, extname file
+ savepath = join output, "#{name}.js"
+ contents = String readFileSync file
+ newcontents = jaded.compile contents, opt
+ writeFileSync savepath, newcontents
+ ++count
renderFolder indir, outdir
console.log "#{count} template#{if count is 1 then '' else 's'} from '#{program.input}' rendered to '#{program.output}'"
View
@@ -2,21 +2,21 @@ jade = require 'jade'
{parser, uglify} = require 'uglify-js'
module.exports =
- minify: (code) -> uglify.gen_code uglify.ast_squeeze uglify.ast_mangle parser.parse code
- beautify: (code, indent=2) -> uglify.gen_code parser.parse(code), beautify: true, indent_level: indent
- compile: (contents, opt={}) ->
- opt.development ?= false
- opt.amd ?= false
- contents = String contents # for buffers
+ minify: (code) -> uglify.gen_code uglify.ast_squeeze uglify.ast_mangle parser.parse code
+ beautify: (code, indent=2) -> uglify.gen_code parser.parse(code), beautify: true, indent_level: indent
+ compile: (contents, opt={}) ->
+ opt.development ?= false
+ opt.amd ?= false
+ contents = String contents # for buffers
- # Jade compile to function string
- opts =
- client: true
- compileDebug: opt.development
- src = String jade.compile contents, opts
+ # Jade compile to function string
+ opts =
+ client: true
+ compileDebug: opt.development
+ src = String jade.compile contents, opts
- # Wrap in amd closure
- #src = "define(['jade'], function(jade) {return #{src};});" if opt.amd
- src = "define(function(jade) {return #{src};});" if opt.amd
- src = (if opt.development then module.exports.beautify(src) else module.exports.minify(src))
- return src
+ # Wrap in amd closure
+ #src = "define(['jade'], function(jade) {return #{src};});" if opt.amd
+ src = "define(function(jade) {return #{src};});" if opt.amd
+ src = (if opt.development then module.exports.beautify(src) else module.exports.minify(src))
+ return src

0 comments on commit 7760eb6

Please sign in to comment.