Closed silverwind closed 9 years ago
Related: #146 Can use a library like basket.js
Also worth investigating if we can load CM itself on demand, which should reduce initial page load a lot as CM is 50% of our JS resources.
Can also add an option to use a cdn for codemirror.
CM is 50% of our JS resources.
Be thankful we aren't using Ace! haha
Honestly though, our page load time and size is stellar compared to any other comparable software out there.
It can't hurt to "lazy-load" CodeMirror though.
I've avoided CDNs until now as I'd like to keep droppy working in an offline scenario with a LAN server.
Guess I can't complain about loading times. The demo is at 1.8s first-load, 0.9s cached. Locally, I'm at around 0.5s/0.3s which is probably alright, but especially in regards to performance, I'm strifing for perfection. :)
Loading times includes script exec?
I think so, yes. It's what Firefox shows in the devtools statusbar.
Golly goodness.
TODO:
I might need a bit of CodeMirror assistance here for modes. I'm dynamically filling a <script>
with the current mode, the console prints confirm that the mode gets loaded into CodeMirror.modes
"CodeMirror.modes before" Array [ "null" ]
"CodeMirror.modes after" Array [ "null", "javascript" ]
But still no syntax highlighting to be seen. Also, html mode gives an rather strange TypeError in the console, not sure what's wrong.
TypeError: htmlMode.startState is not a function
Might have to do something like this:
https://github.com/marijnh/CodeMirror/blob/master/addon/mode/loadmode.js
Can certainly optimize the code a bit more, but this works now. :+1:
Initial load down to about 1.2s from 1.8s Cached load down to about 0.7s from 0.9s
I might have to remove that loading animation circle soon. :tongue:
You do not need to do any extra work than loading the mode script, and if the mode script is not loaded it falls back to plain text.
On Fri, Sep 5, 2014 at 4:08 PM, silverwind notifications@github.com wrote:
I might need a bit of codemirror assistance here for modes. I'm dynamically filling a Githubissues.
Githubissues is a development platform for aggregating issues.
As discussed: https://github.com/silverwind/droppy/issues/43