From 634c125d366ff2f1f200fff742788d0e76cb7634 Mon Sep 17 00:00:00 2001 From: Nikolaus Graf Date: Wed, 18 May 2011 03:43:35 +0200 Subject: [PATCH] js code convention --- lib/compilers/base.js | 12 ++++++------ lib/compilers/stylus.js | 8 ++++---- src/compilers/base.coffee | 12 ++++++------ src/compilers/stylus.coffee | 6 +++--- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/compilers/base.js b/lib/compilers/base.js index 8943cb02d..889d3bb27 100644 --- a/lib/compilers/base.js +++ b/lib/compilers/base.js @@ -17,12 +17,12 @@ }; Compiler.prototype.compile = function(files) {}; Compiler.prototype.fileChanged = function(file) { - this._changed_files || (this._changed_files = []); - this._changed_files.push(file); - clearTimeout(this._timeout); - return this._timeout = setTimeout(__bind(function() { - _.bind(this.compile, this, this._changed_files)(); - return this._changed_files = null; + this.changedFiles || (this.changedFiles = []); + this.changedFiles.push(file); + clearTimeout(this.timeout); + return this.timeout = setTimeout(__bind(function() { + _.bind(this.compile, this, this.changedFiles)(); + return this.changedFiles = null; }, this), 20); }; return Compiler; diff --git a/lib/compilers/stylus.js b/lib/compilers/stylus.js index 5e8e62124..cdff9e4a7 100644 --- a/lib/compilers/stylus.js +++ b/lib/compilers/stylus.js @@ -23,14 +23,14 @@ return [/\.styl$/]; }; StylusCompiler.prototype.compile = function(files) { - var main_file_path; - main_file_path = path.join(this.options.brunchPath, 'src/app/styles/main.styl'); - return fs.readFile(main_file_path, 'utf8', __bind(function(err, data) { + var mainFilePath; + mainFilePath = path.join(this.options.brunchPath, 'src/app/styles/main.styl'); + return fs.readFile(mainFilePath, 'utf8', __bind(function(err, data) { var compiler; if (err != null) { return helpers.log(colors.lred('stylus err: ' + err)); } else { - compiler = stylus(data).set('filename', main_file_path).set('compress', true).include(path.join(this.options.brunchPath, 'src')); + compiler = stylus(data).set('filename', mainFilePath).set('compress', true).include(path.join(this.options.brunchPath, 'src')); if (this.nib()) { compiler.use(this.nib()); } diff --git a/src/compilers/base.coffee b/src/compilers/base.coffee index 83ffc8348..6a200b6d6 100644 --- a/src/compilers/base.coffee +++ b/src/compilers/base.coffee @@ -17,10 +17,10 @@ class exports.Compiler # can be overwritten to change behavior on file changed events # by default waits 20ms for file events then calls compile with all changed files fileChanged: (file) -> - @_changed_files ||= [] - @_changed_files.push(file) - clearTimeout(@_timeout) - @_timeout = setTimeout( => - _.bind(@compile, @, @_changed_files)() - @_changed_files = null + @changedFiles ||= [] + @changedFiles.push(file) + clearTimeout(@timeout) + @timeout = setTimeout( => + _.bind(@compile, @, @changedFiles)() + @changedFiles = null , 20) diff --git a/src/compilers/stylus.coffee b/src/compilers/stylus.coffee index 623fd1e3b..118c1a6e8 100644 --- a/src/compilers/stylus.coffee +++ b/src/compilers/stylus.coffee @@ -12,13 +12,13 @@ class exports.StylusCompiler extends Compiler [/\.styl$/] compile: (files) -> - main_file_path = path.join(@options.brunchPath, 'src/app/styles/main.styl') - fs.readFile(main_file_path, 'utf8', (err, data) => + mainFilePath = path.join(@options.brunchPath, 'src/app/styles/main.styl') + fs.readFile(mainFilePath, 'utf8', (err, data) => if err? helpers.log colors.lred('stylus err: ' + err) else compiler = stylus(data) - .set('filename', main_file_path) + .set('filename', mainFilePath) .set('compress', true) .include(path.join(@options.brunchPath, 'src'))