cloudwall icon indicating copy to clipboard operation
cloudwall copied to clipboard

Syntax coloring

Open johs opened this issue 7 years ago • 6 comments

JS syntax coloring not aware of templates in my favorite app Ddoc lab screen shot 2018-04-26 at 14 32 46

johs avatar Apr 26 '18 14:04 johs

Yes, it‘s known problem of CodeMirror parser, which was fixed very recently. So fix is not yet propagated to public versions of CloudWall and Ddoc Lab. I‘ll get you know when update is ready.

If template literals highlighting is critical right now, consider doing these steps:

  • get https://github.com/codemirror/CodeMirror/blob/master/mode/javascript/javascript.js
  • open /lib/plugins.js CloudWall ddoc attachment
  • find string //codemirror javascript in plugins.js
  • replace code block following //codemirror javascript comment with updated highlighter you got from github
  • important: be careful not to remove subsequent parsers in plugins.js accidentally
  • save attachment back and reload CloudWall.

ermouth avatar Apr 26 '18 14:04 ermouth

Not critical:) Easy to isloate in the js code with templates as ddoc fragments too (d,i) => {/*{{.template.hello}}*/}

Another ES6 detail: Uglify in JS resources seems to ignore let and const And how about an ES6 transpiler as a feature on JS resources?:)

johs avatar Apr 26 '18 14:04 johs

Uglify in JS resources seems to ignore let and const

Can you please give an example, how it looks like? Btw, do you use CloudWall or Ddoc lab standalone? And of which version?

And how about an ES6 transpiler as a feature on JS resources?

Very unlikely. I‘ve made some experiments a year ago, results where disappointing: enormously bloated code, running pretty slow.

ermouth avatar Apr 27 '18 01:04 ermouth

Thanks, I use Ddoc lab 1.9.20 in CloudWall 2.2.3, couchapp build this is how a build looks like without and with uglifyer

screen shot 2018-04-27 at 07 37 37 screen shot 2018-04-27 at 07 38 01 Looks like `const` screws things up.

johs avatar Apr 27 '18 05:04 johs

Looks like const screws things up.

It doesn‘t. Your const is removed since it‘s dead code, never used. However, if you use b somewhere in expression, it will be inlined in expression by value, since its value is precisely known during uglify )

ermouth avatar Apr 27 '18 10:04 ermouth

Thanks! Uglify really smart too:)

johs avatar Apr 27 '18 10:04 johs