aboutsummaryrefslogtreecommitdiffstats
path: root/Cakefile
diff options
context:
space:
mode:
authorJohan Liesén2012-08-07 15:51:09 +0200
committerJohan Liesén2012-08-07 15:58:31 +0200
commita3ada283711d73737e5de13f5cb5d30f23a8312c (patch)
treef48d1d5c3e73ef8a0b23fcf2447a28fcea9e9722 /Cakefile
parent92814351ffbeded7e00d433daf2b22812fa1b41f (diff)
downloadvimium-a3ada283711d73737e5de13f5cb5d30f23a8312c.tar.bz2
Keep any .js with a corresponding .coffee
Diffstat (limited to 'Cakefile')
-rw-r--r--Cakefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Cakefile b/Cakefile
index 7506f349..a90f7e64 100644
--- a/Cakefile
+++ b/Cakefile
@@ -18,9 +18,15 @@ task "clean", "removes any js files which were compiled from coffeescript", ->
fs.readdirSync(directory).forEach (filename) ->
return if (filename.indexOf ".js", filename.length - ".js".length) == -1
filepath = "#{directory}/#{filename}"
- return if filepath == "background_scripts/main.js"
return unless (fs.statSync filepath).isFile()
- fs.unlinkSync filepath
+
+ # Check if there exists a corresponding .coffee file
+ try
+ coffeeFile = fs.statSync "#{filepath.slice 0, -".js".length}.coffee"
+ catch _
+ return
+
+ fs.unlinkSync filepath if coffeeFile.isFile()
task "autobuild", "continually rebuild coffeescript files using coffee --watch", ->
coffee = spawn "coffee", ["-cw"].concat(src_directories)