Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 30 18:36
    kumavis opened #236
  • Sep 29 18:00
    dependabot[bot] labeled #235
  • Sep 29 17:59
    dependabot[bot] opened #235
  • Sep 29 17:59

    dependabot[bot] on npm_and_yarn

    Bump i from 0.3.6 to 0.3.7 Bum… (compare)

  • Sep 21 17:12
    dependabot[bot] labeled #234
  • Sep 21 17:12
    dependabot[bot] opened #234
  • Sep 21 17:12

    dependabot[bot] on npm_and_yarn

    Bump tmpl from 1.0.4 to 1.0.5 … (compare)

  • Sep 09 05:23
    iamfj commented #210
  • Aug 15 13:33
    sayoojbkumar opened #233
  • Aug 11 00:53
    dependabot[bot] labeled #232
  • Aug 11 00:53
    dependabot[bot] opened #232
  • Aug 11 00:53

    dependabot[bot] on npm_and_yarn

    Bump path-parse from 1.0.6 to 1… (compare)

  • Jul 22 06:10
    wombatastronaut opened #231
  • Jul 22 06:07
    wombatastronaut closed #230
  • Jul 22 05:16
    wombatastronaut opened #230
  • Jul 15 01:41
    coolaj86 edited #229
  • Jul 15 01:36
    coolaj86 edited #229
  • Jul 15 01:36
    coolaj86 edited #229
  • Jul 15 01:36
    coolaj86 edited #229
  • Jul 15 01:35
    coolaj86 edited #229
jmmclean
@jmmclean
@nebrelbug reason for string input is bc I use papaparse to convert a CSV to JSON, then pipe it into squirrelly. All part of some batch processing we have.
Ben Gubler
@nebrelbug
@jmmclean ah, that makes sense :thumbsup:
Joshua Amaju
@joshua_amaju_twitter
@nebrelbug no it didn't. I tried {{@include("..partials/signup") /}} (and also with the .html file extension) from the pages directory. The partials directory is at the same level with the partials directory.
Ben Gubler
@nebrelbug
@joshua_amaju_twitter you have to use includeFile instead of include. Also, I'm guessing it should be "../partials" instead of "..partials". Let me know if that works :)
jmmclean
@jmmclean
@nebrelbug is there any reason to have the dist folder in the git repo? Normally thats dynamically created from typescript via a build process
Joshua Amaju
@joshua_amaju_twitter
@nebrelbug there should be some kind of documentation on using squirrelly with nodejs. I'm stuck guess how to also define helpers. I'll try your solution and let you know if it works.
Ben Gubler
@nebrelbug
@jmmclean hmm... I remember considering that a while ago, but ultimately deciding against it. Now that I think more about the idea, it sounds like it would have some definite advantages (especially not having to commit every time we rebuild and format).
Ben Gubler
@nebrelbug

I've been updating Eta, Squirrelly's companion project, and just added support for Deno. I'm planning to merge those changes into Squirrelly (along with some file handling improvements) soon.

However, for Deno support, we have to generate a deno_dist folder in the GitHub repo. I'm not sure whether it would confuse users to have a deno_dist folder and not a dist folder, and we would still have to commit every time.

I guess one possible solution would be to create a GitHub action that would create the deno_dist folder on every commit (removing the need to commit locally and build every PR manually).
@joshua_amaju_twitter I'm planning to update the documentation soon. Hope it works for you -- if not, hopefully I'll have some good examples by then :thumbsup:
jmclean-cnexus
@jmclean-cnexus
@nebrelbug would you like me to remove the dist dir? Im happy to do it. Unfortunately, i dont know enough about deno to figure out the CI to make it more programatic. FYI, this the jmmclean user, but a different profile
Ben Gubler
@nebrelbug

@jmclean-cnexus that would be great!

Right now I use https://github.com/sindresorhus/np to publish, but I'm not sure what the best way to generate the dist folder before publishing is. Maybe a package.json script like "release": "npm run build && np"?

jmclean-cnexus
@jmclean-cnexus
@nebrelbug thats absolutely the right way! just like when you are building an archive for an application, you would do something like npm run build && npm prune --production && npm run archive or something like that
Aaron
@aarongerig

Hi all
I'm struggling to use the @each template helper. When rendering the template, Squirrelly throws me following error:

Squirrelly Error: invalid syntax at line 17 col 48:
{[@each(it.door_icons) =&gt; image_path, index]}<div>{[image_path]}</div>{[/each]}

Here's my original piece of code:

{[@each(it.door_icons) => image_path, index]}<div>{[image_path]}</div>{[/each]}

As you can see I customized my opening {[and closing ]} tags since I'm using Squirrelly in a Twig context. It works well for the @if template helper, some custom filters and helpers. What am I doing wrong?

Btw, the syntax error in my console points to the => characters in the @each statement.
each_error.png
Squirrelly version: 8.0.8
Ben Gubler
@nebrelbug
@aarongerig hmm... it looks like your template is somehow being XML-escaped ahead of time. => is being transformed into =&gt; (&gt; is the HTML code for >) and that's resulting in a syntax error.

My guess is that Twig is XML-escaping the template? I'm not sure exactly how you're using Twig, but hopefully there's some way to disable XML-escaping on the template and check if it solves your problem.

Hope this helps :smiley:

Aaron
@aarongerig
@nebrelbug Thanks for your suggestion! It seems that Twig is not escaping it, but after retrieving the HTML in my JavaScript (I'm using the HTML5 <template> tag => https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template) the HTML is escaped. 🤔
Ben Gubler
@nebrelbug
@aarongerig ah, I've run into that problem before!

Hmm... the best way might be to put your template in a script tag.

<script id="template" type="text/x-squirrelly-template">
Your template here
</script>

Since the script type is unrecognized, calling innerHTML should give you the raw inner content :). Handlebars and others recommend using the <script> tag as well.
Let me know if this helps!

Aaron
@aarongerig
@nebrelbug Thank you so much! This solved my problem. Btw, awesome rendering engine you've written here. I enjoy using it :)
Ben Gubler
@nebrelbug
@aarongerig I'm glad it fixed it! Thanks!
tabarra
@tabarra
Well, I just noticed that on the jump to v8 the filters are now also sanitized
so no "new line to <br>" filter
RIP
tabarra
@tabarra
I think you should provide some default filters
nl2br is a great one
Ben Gubler
@nebrelbug
@tabarra oops, that was another unintended effect of https://github.com/squirrellyjs/squirrelly/releases/tag/v8.0.4 :grimacing:. The best option is probably to disable auto-escaping and move auto-escaping into defaultFilter (defaultFilter is still called before all other filters, which is slightly inconsistent)
As far as default filters, I think we probably want to keep the core library size down. However, it would be awesome if someone created a filter library that would load lots of helpful filters (like nl2br, join, first, etc.) into Squirrelly.
Ben Gubler
@nebrelbug

@/all Hey everyone! Just wanted to share that Squirrelly is looking for a new lead maintainer: see squirrellyjs/squirrelly#210. As of October 28th, I will be unable to continue developing the project.

My plan is to have Squirrelly's API stabilized and well-tested by that time. We should also have fairly decent documentation, several plugins, and integrations with popular tools and server frameworks.

In case I'm unable to find a maintainer, I have backup plans to ensure that Squirrelly can continue to be developed (see the link above for more info).

Several of you on this chat have been influential in guiding Squirrelly's progress -- message me if you would like to become a maintainer! (In the link above, I listed a few maintainer requirements you should check first)

I've loved working with all of you throughout Squirrelly's development, and hope it has been a helpful tool. Best wishes to all of you!
tabarra
@tabarra
Congratz on your new job!
It will be sad to not have you on the frontline of this project tho :(
Ben Gubler
@nebrelbug
Thanks @tabarra! I've enjoyed collaborating with you.
Ben Gubler
@nebrelbug
If anybody would like to contribute to Squirrelly, I've added it to Code Shelter. They should be able to vet potential contributors and grant edit and release access :)
thearthouse
@thearthouse
why googlebot cannot render Sqrl content? on google search its only showing {{title}}.
Saia Fonua
@sfonua10
I'm new to squirrlleyjs, is there a way to log out data coming in to a page?
isgj
@isgj_gitlab
Hi does v7 support #elif (...)?
Ilan Levy
@ilanl
Hi guys, I really love this template engine, currently using it in Node. But is there a port in Python?
tabarra
@tabarra
@nebrelbug hey ben, i know you are not maintaining it anymore
but there is some high severity CVE for squirrelly
any chance of a fix?
Tom MacDonald
@tsmacdonald51
Does squirelly v8 support inline partials like Handlebars?
Kathrin De Cecco
@kathrindc
Hey everyone, sorry if it's a dumb question, but I'm trying to use JS-style fallbacks in my templates and I'm consistently getting bad template syntax errors. Any ideas how I could provide a fallback value for something? (eg. something.property contains null and I'd like to use an empty string as a fallback value so it doesn't print null in the rendered output)
Aaron
@aarongerig

@kathrindc You could define a custom „default“ filter, which either returns the given value or a passed fallback value if the original one is null.

Here‘s an example:

Sqrl.filters.define('default', (value, fallback = '') => value || fallback);
Kathrin De Cecco
@kathrindc
Ah okay, so I'm currently using squirrelly via express. Where would I need to define that helper?
Aaron
@aarongerig
Hmmm… anywhere you have access to the Squirelly library and before you actually render the template.
Kathrin De Cecco
@kathrindc
Yup, turns out the easiest way to use custom filters was to bypass the express integration completely. I tried passing the required module into app.set('view engine', Sqrl), but that expected a string. So I'll just use a wrapper module to pre-configure Squirrelly. Thanks a lot for the tip @aarongerig ^-^