Tritium is a magical document modifying language. It's JavaScript-like and simple to learn. Think XSLT without the nightmare. It was designed by Hampton Catlin (@hcatlin), and has been heavily influenced by Aaron Leung (@akhleung).
There appears to be a bug in the read() function. Specifically, I want to import a JS file that lives in a the /scripts/pages/foo_folder/foo.js from a path of scripts/bar_folder/_bar.ts. The lines would read something like this
inject(read("templateStore.js"))
but that spits back an error of:
/usr/local/rvm/gems/ruby-1.9.2-p180@1800flowers/gems/tritium-0.4.151/lib/tritium/parser/parser.rb:265:in `read': No such file or directory - /Users/jefeman/workspace/1800flowers/scripts/template/templateStore.js
/usr/local/rvm/gems/ruby-1.9.2-p180@1800flowers/gems/tritium-0.4.151/lib/tritium/parser/parser.rb:265:in `read': No such file or directory - /Users/jefeman/workspace/1800flowers/scripts/pages/templatized/pages/templatized/templateStore.js
Alrighty, so its doubling the path. That's odd. Let's try another. (Although I don't expect this one to work)
inject(read("../templateStore.js"))
but that spits back an error of
/usr/local/rvm/gems/ruby-1.9.2-p180@1800flowers/gems/tritium-0.4.151/lib/tritium/parser/parser.rb:265:in `read': No such file or directory - /Users/jefeman/workspace/1800flowers/scripts/template/../templateStore.js (Errno::ENOENT)
Okay! Another go (still don't expect this one to work)
inject(read("../templatized/templateStore.js"))
but alas
/usr/local/rvm/gems/ruby-1.9.2-p180@1800flowers/gems/tritium-0.4.151/lib/tritium/parser/parser.rb:265:in `read': No such file or directory - /Users/jefeman/workspace/1800flowers/scripts/template/../templatized/templateStore.js (Errno::ENOENT)
/usr/local/rvm/gems/ruby-1.9.2-p180@1800flowers/gems/tritium-0.4.151/lib/tritium/parser/parser.rb:265:in `read': No such file or directory - /Users/jefeman/workspace/1800flowers/scripts/pages/templatized/pages/templatized/templateStore.js (Errno::ENOENT)
Alright, so I think we found the issue. Its when you provide the exact path that the relative path dude takes over and messes things. That's why we could have ../ in some paths, see them in the path, but when you provide the correct path, it barfs. PUKE!
Hampton
There appears to be a bug in the read() function. Specifically, I want to import a JS file that lives in a the /scripts/pages/foo_folder/foo.js from a path of scripts/bar_folder/_bar.ts. The lines would read something like this
but that spits back an error of:
Where the important thing is
Okay. So its looking in the local folder structure. It just didn't work when it was relative. So let's trying giving it a path that would fix it.
but that spits back an error of:
Alrighty, so its doubling the path. That's odd. Let's try another. (Although I don't expect this one to work)
but that spits back an error of
with the important part being
Okay! Another go (still don't expect this one to work)
but alas
we get this.
Okay. Last one
and behind door number 3 is....
where we now have
Alright, so I think we found the issue. Its when you provide the exact path that the relative path dude takes over and messes things. That's why we could have ../ in some paths, see them in the path, but when you provide the correct path, it barfs. PUKE!