Closed revans closed 13 years ago
I just feel that workflow should be like this:
Here is what Wynn had changed with the paths for compiling Coffeescripts:
def compile_coffee puts "Compiling CoffeeScript".blue paths =
find src/#{@ticonfig.name} -name '*.coffee'`.split("\n")
compilation = (
system "coffee -p --join --bare #{paths.join(' ')} > Resources/#{@ticonfig.name.downcase!}.js" and
system "coffee -p --bare src/app.coffee > Resources/app.js"
)
if compilation puts "Successfully compiled CoffeeScript".green else puts "Error compiling CoffeeScript".red end compilation end `
Take a look and let me know what you think. I personally feel getting the compile options (coffeescript/sass) inside Ti, limits the flexibility of how the user wants to compile the sass/coffeescript files. We are providing source code in sass/coffeescript and hence we should allow the user to make a choice of how to compile it. If tomm. things change with these tools, we don't want to chase them and have Ti coupled with them. Just my 2 cents.
I disagree.
The above does not solve the problem of compiling coffee-scripts in specific order and puts the problem on the developer to figure out a clean solution for doing so.
Ti should provide this solution out of the box, which is does now, with the Ti::Compiler::CoffeeScripts. The process is the same process for importing sass files, which most developers are now used to. Sprockets follows this as well.
Check the implementation: https://github.com/codewranglers/Ti/commit/ba88674320f2ff4bb517b8f1db3d8b3ffc1c5d7a
I've noticed that there's a big difference between the compiled js from the original Rakefile
and Ti::Compiler::CoffeeScripts
Ti::Compiler::CoffeeScripts
is using execjs
to output the js
file, thus with coffeescript is different. The coffee-script
ruby compiler that we are using in ti
lacks other option which is very critical for compiling the js
here are the compilation options that are missing from the coffee-script gem
-j, --join concatenate the scripts before compiling
I'm thinking of building another compiler or just patching the gem that we are using to have that option in.
Thoughts?
I've pushed an update to address this. Did a diff using both versions (ti compile && rake compile) and there is no difference now.
Needs to use Ti::Compiler::CoffeeScripts.