These are chat archives for ractivejs/ractive

14th
Mar 2018
Joseph
@fskreuz
Mar 14 2018 00:30
Random question of the day: How important are source maps to you? Specifically, if you were able to write TS and/or SCSS in component files, how important is it to debug the actual source versus the generated code?
Just bringing it up because I see source maps as important, but I read somewhere (while debugging something Webpack-y a few days ago) that developers are willing to sacrifice source maps entirely for other things (performance, debugging real code versus tracing mapped code, build times etc.)
Cerem Cem ASLAN
@ceremcem
Mar 14 2018 00:33
I'm using Livescript and if the sourcemaps weren't available, I would have to quit using it.
build time shouldn't be a problem IMHO, my current incremental build time is 1 second in a "big" project.
I think same would apply to TS
Joseph
@fskreuz
Mar 14 2018 00:41
Well, compiling with the official compilers is one thing. They'll always generate good source maps. Building the tools that take that compiled output and turn it to something else is the challenge. :grin:
Like say... write TS in a component file, extract that TS, compile it with tsc, turn it into ESM/CJS, add/edit/remove stuff from code, and map that JS aaall the way back to the component file's TS. :grin:
Chris Reeves
@evs-chris
Mar 14 2018 01:14
I kinda gave up on sourcemaps
they're really nice when they work, but sometimes they fall over real hard
it would be nice to have the template chunk mapped around for single file components
Cerem Cem ASLAN
@ceremcem
Mar 14 2018 01:50
@evs-chris do I have a chance to pass variables as is inside a component? Playground
as if {{yield}} is used as template, but also "*.init" like events should be fired, like {{>content}} is used as the template.
Cerem Cem ASLAN
@ceremcem
Mar 14 2018 02:09
...or is the only way passing variable by attributes: Playground
Chris Reeves
@evs-chris
Mar 14 2018 02:18
I think you could probably flip that over and subscribe to bubble events on the root instance during component init
I'll poke at it some when I get to a real machine
Cerem Cem ASLAN
@ceremcem
Mar 14 2018 02:18
so no namespace component
Chris Reeves
@evs-chris
Mar 14 2018 02:19
another option may be too use a namespace macro, so it doesn't add to the context chain
Cerem Cem ASLAN
@ceremcem
Mar 14 2018 02:34
I'm impatient to use macros
Cerem Cem ASLAN
@ceremcem
Mar 14 2018 11:36
isn't {{yield}} work with macros: Playground (where it works with {{>content}})
Chris Reeves
@evs-chris
Mar 14 2018 13:34
there's no yield for macros because they are already effectively just a partial
there's no context from which to yield
Joseph
@fskreuz
Mar 14 2018 13:37
When you write the function form of css in an SFC, is this how it's written? (a script block returning a string?)
<script>
  return `
    table {
      color: ${data.color}
    }
  `
</script>
I think it had a rel but ignoring that for now.
Paul Maly
@PaulMaly_twitter
Mar 14 2018 14:10
@evs-chris What purpose of macros? I never felt I need somethings besides components and partials.
Chris Reeves
@evs-chris
Mar 14 2018 14:33
@fskreuz that but ${data('color')} because data is basically ractive.get wrapped up just for the style data
makes it easier to get deeply nested paths that may not exist
you can also use a ractive template, but it's more expensive to compute
I imagine that's how most people would want to go for ease of use
Joseph
@fskreuz
Mar 14 2018 14:35
:thumbsup: thanks
Chris Reeves
@evs-chris
Mar 14 2018 14:36
@dagnelies macros are just dynamic partials that give you much more control over the render process and allow you to pass in args
they're used internally to implement async components and await blocks
Chris Reeves
@evs-chris
Mar 14 2018 14:43
sorry, meant @PaulMaly_twitter , but somehow mobile gitter did something weird and I got @dagnelies instead
one day I'm gonna give up and write a keyless keyboard for Android to keep me from being tempted to try to write stuff on my phone
Paul Maly
@PaulMaly_twitter
Mar 14 2018 14:46
Ok, thanks!
Cerem Cem ASLAN
@ceremcem
Mar 14 2018 16:51
can macros have event definitions?
Juan C. Andreu
@andreujuanc
Mar 14 2018 22:03
is it possible to get jsbeautifier to format mustaches correctly??? D:
I get {{}} {{}} {{/}} {{/}} instead of
{{}}
    {{}}
    {{/}}
{{/}}
:straight_ruler:
For VSCODE users: Settings > "html.format.indentHandlebars": true
Chris Reeves
@evs-chris
Mar 14 2018 22:10
macros can't have events, no
@andreujuanc what about mustaches with # at the beginning?
Juan C. Andreu
@andreujuanc
Mar 14 2018 22:24
Like this: {{#if}}{{/if}}
?
Worked fine for me, using partials
{{#partial mypartial}}
{{/partial}}
Ive been strugging with this for months xD
Chris Reeves
@evs-chris
Mar 14 2018 23:06
yeah, I'd expect the #if, etc ones to be able to indent correctly, as they're inherently block-ish
Juan C. Andreu
@andreujuanc
Mar 14 2018 23:06
@evs-chris how can I pass content to another components content? It's giving me headaches. Cant use yield
DEMO:
It's thowing "Maximum call stack size exceeded" D:
Chris Reeves
@evs-chris
Mar 14 2018 23:19
you would have to yield in both components using a {{yield with ...}} in at least one
I'll see if I can get an example when I get to a real machine
Juan C. Andreu
@andreujuanc
Mar 14 2018 23:20
Sure, no prob.
Just wondering if it was possible
Juan C. Andreu
@andreujuanc
Mar 14 2018 23:26
Works, but with the alias. Impossible to do without aliases?? cos my "item template" instead of <b>{{text}}</b> goes like <b>{{item.text}}</b> where item is the alias name for the yield context.
I'ts not bad, just need to inform my team to do {{item.<propertyname>}} when using "cutelist"