From fa24f5db23eb8f501e9ea76b4da27d3e7ea1a91e Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 24 Sep 2015 13:06:34 -0700 Subject: [PATCH] Support dynamically reloading custom file .csscomb.json file changes Instead of using require which caches the result, check if file exists and then use it if it does, otherwise fall back to bundled config. --- src/beautifiers/csscomb.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/beautifiers/csscomb.coffee b/src/beautifiers/csscomb.coffee index 7519fe0..1d9afa2 100644 --- a/src/beautifiers/csscomb.coffee +++ b/src/beautifiers/csscomb.coffee @@ -1,5 +1,6 @@ "use strict" Beautifier = require('./beautifier') +fs = require('fs') module.exports = class JSBeautify extends Beautifier name: "CSScomb" @@ -23,7 +24,12 @@ module.exports = class JSBeautify extends Beautifier try # Load from Project's .csscomb.json projectConfigPath = atom.project.getDirectories()?[0]?.resolve('.csscomb.json') - config = require(projectConfigPath) # Will throw error if does not exist + #config = require(projectConfigPath) # Will throw error if does not exist + + stats = fs.statSync(projectConfigPath) + + config = Comb.getCustomConfig(projectConfigPath) + catch e # Fallback to csscomb config = Comb.getConfig('csscomb')