These are chat archives for ractivejs/ractive

1st
Nov 2017
Joseph
@fskreuz
Nov 01 2017 13:59
Anyone here use templating languages for templates other than Ractivebars ? :grin: Just curious. I know @ceremcem uses... pug, yes?
And while I'm at it, add CSS as well, language and framework.
Martin Kolárik
@MartinKolarik
Nov 01 2017 14:07
been using twig in some projects
kouts
@kouts
Nov 01 2017 14:07
I'm using twig for some stuff
also smarty
which is also php
in js I have used markup.js
and also this:
function speedyTemplate(template) {

    var strFunc = "return ('" +

    template.replace(/[\r\t\n]/g, " ")
            .replace(/'(?=[^#]*#>)/g, "\t")
            .split("'").join("\\'")
            .split("\t").join("'")
            .replace(/<#=(.+?)#>/g, "' + $1 + '")
            .split("<#").join("');")
            .split("#>").join("p.push('")
            + "');";

    return new Function("data", strFunc);
}
Joseph
@fskreuz
Nov 01 2017 14:19
Would it make sense for templates to be like pug -(pug parser)-> Template that Ractive understands -(Ractive)-> Compiled Ractive? Like a... pre-processor?
Thinking of something like the following for component files:
<link rel="ractive" name="SomeComponent" href="...">
<template>
  write pug here
</template>
<style>
  write scss here
</style>
<script>
  write typescript here
</script>
Loader takes care of the details in turning it to a constructor/source.
Martin Kolárik
@MartinKolarik
Nov 01 2017 14:24
I hate pug :D
or do you mean in each section you could choose your favorite language?
Joseph
@fskreuz
Nov 01 2017 14:26
Well, pug is the only templating language I know that's not handlebars. And it looks funny. :D
But yeah, write in any language you want (as long as the loader or its config supports it or if it's even practical).
Or does everyone just write vanilla 95% of the time (ractive or no ractive)?
Martin Kolárik
@MartinKolarik
Nov 01 2017 14:40
I always write "vanilla" ractive :D
kouts
@kouts
Nov 01 2017 14:41
I write "vanilla" ractive too
Martin Kolárik
@MartinKolarik
Nov 01 2017 14:41
and less + whatever is the latest version of ES
Joseph
@fskreuz
Nov 01 2017 14:55
I use Ractive with scss, but scss is external so yeah... wishing true code co-location for components. :grin:
Cerem Cem ASLAN
@ceremcem
Nov 01 2017 15:30
@fskreuz yes, I compose Ractive templates in Pug. I use Livescript for Javascript and CSS for CSS (because I didn't spare some time to write a preprocessor for less/sass) and Ractive itself (with <style> tag)

I hate pug :D

any person coming from Python would probably love Pug, I guess

Cerem Cem ASLAN
@ceremcem
Nov 01 2017 15:42

Would it make sense for templates to be like pug -(pug parser)-> Template that Ractive understands -(Ractive)-> Compiled Ractive? Like a... pre-processor?

That would be great (and I'm almost following this path) but it would be less valuable without ractivejs/ractive#2226

Cerem Cem ASLAN
@ceremcem
Nov 01 2017 20:56
@evs-chris @fskreuz is it normal not being vanished when x button is clicked here?
Chris Reeves
@evs-chris
Nov 01 2017 20:58
the key? yes, because the key still exists
if you want to delete a key, you need to add a helper method
Cerem Cem ASLAN
@ceremcem
Nov 01 2017 20:58
yes, the key
...and use delete in it?
Chris Reeves
@evs-chris
Nov 01 2017 21:00
here you go
Cerem Cem ASLAN
@ceremcem
Nov 01 2017 21:01
that looks great!
Cerem Cem ASLAN
@ceremcem
Nov 01 2017 22:20
by the way, what is the 'platforms' in 'platforms affected' in the issue template?
Chris Reeves
@evs-chris
Nov 01 2017 22:23
node, ie, android browser, everything, etc
Cerem Cem ASLAN
@ceremcem
Nov 01 2017 22:24
hmm, got it