Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 16 17:52
    dependabot[bot] labeled #243
  • May 16 17:52
    dependabot[bot] opened #243
  • May 16 17:52

    dependabot[bot] on npm_and_yarn

    Bump ajv from 6.12.0 to 6.12.6 … (compare)

  • May 16 17:52
    dependabot[bot] labeled #242
  • May 16 17:52
    dependabot[bot] opened #242
  • May 16 17:52

    dependabot[bot] on npm_and_yarn

    Bump trim-off-newlines from 1.0… (compare)

  • Mar 21 14:51
    7flash opened #241
  • Feb 23 05:54
    Kukunin opened #240
  • Feb 17 09:29
    ilanl commented #104
  • Feb 11 17:59
    StefanJelner commented #131
  • Feb 11 17:59
    StefanJelner commented #131
  • Feb 11 17:56
    StefanJelner commented #131
  • Feb 05 16:49
    sw360cab commented #238
  • Jan 15 06:02
    dependabot[bot] labeled #239
  • Jan 15 06:02
    dependabot[bot] opened #239
  • Jan 15 06:02

    dependabot[bot] on npm_and_yarn

    Bump shelljs from 0.8.4 to 0.8.… (compare)

  • Dec 14 2021 03:46
    jianyexi opened #238
  • Nov 08 2021 21:50
    brsanthu closed #218
  • Nov 08 2021 21:50
    brsanthu commented #218
  • Nov 08 2021 19:35
    Rybadour commented #218
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 ^-^
Dave Myron
@contentfree
Is there a CLI for Squirrelly? I have a template in a file that I want to parse with Squirrelly (that will then be fed into an image rendering pipeline)
Abdullah Alharbi
@W2AlharbiMe
hello
i have quick question for the creators or for anyone that know the reason, why there's eta and squirrelly ?
why not only one template engine
Ilan Levy
@ilanl
Hi, I'm wondering if we can use squirrelsj to render a JSON as template ?