Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 03 17:40
    jasonfutch commented #132
  • Nov 20 14:03
    hrsetyono commented #65
  • Nov 20 14:02
    hrsetyono commented #65
  • Nov 18 23:49

    nebrelbug on master

    v7.9.0 (compare)

  • Nov 18 23:49

    nebrelbug on v7.9.0

    (compare)

  • Nov 18 16:14
    nebrelbug commented #65
  • Nov 18 03:14
    hrsetyono commented #65
  • Nov 16 17:23

    nebrelbug on master

    Update README.md (compare)

  • Nov 15 21:05

    nebrelbug on master

    Added sideEffects:false Updated README badges to shield… Merge branch 'master' of https:… (compare)

  • Nov 15 17:13

    nebrelbug on master

    Add Emoji to README Merge pull request #133 from sq… (compare)

  • Nov 15 17:13
    nebrelbug closed #133
  • Nov 15 17:13
    nebrelbug ready_for_review #133
  • Nov 15 16:39

    nebrelbug on master

    Update feature_request.md (compare)

  • Nov 15 16:38

    nebrelbug on master

    Update bug_report.md (compare)

  • Nov 15 16:37

    nebrelbug on master

    Fix template emoji (compare)

  • Nov 15 16:36

    nebrelbug on master

    Update bug_report.md (compare)

  • Nov 15 16:30
    nebrelbug opened #133
  • Nov 15 16:29

    nebrelbug on emojify

    Add Emoji to README (compare)

  • Nov 14 16:32
    nebrelbug opened #132
  • Nov 14 00:03

    nebrelbug on v7.8.0

    (compare)

Gavin McFarland
@limitlessloop
@nebrelbug useful to know about the functions that let you pass callback functions, I’d just never seen that style of syntax before {{~each(@arr):indx, val}}
Ben Gubler
@nebrelbug
@limitlessloop yeah, it would be a fairly unique notation.
Ben Gubler
@nebrelbug

Hi @/all! In addition to Squirrelly-next, I'm considering creating another template engine. This engine would have around the same syntax as Squirrelly v8, but not allow inline JS expressions except &&, ||, etc., and would use at least one other package (a parser package, probably nearley.)

This would allow for relatively safe user-defined templates, and would take all complicated processing logic out of the templates and into helpers and filters, while still preserving Squirrelly's flexibility. What do you think?

Pavel Bucka
@penge
kudos! glad you created squirrelly, as other solutions seemed too heavy, bloated.
I actually got into similar state when started a blog recently. And ended up creating own static site generator :D
donpedro
@donpedro
@nebrelbug I'm all for options, and while I appreciate the speed and beauty you get from hand-crafting all the code, I say if you can use someone else's code to avoid reinventing the wheel I'm all for it. Safe templates, complex logic in add-ons and portability for existing templates sounds great to me!
Ben Gubler
@nebrelbug
@donpedro Great to hear!
iamw00t
@iamw00t
Hello folks, I am curious what's the browser support for this?
Ben Gubler
@nebrelbug
Theoretically, it should work in all modern browsers. I've tested it on IE11, Chrome, and Firefox, but can't get my hands on a copy of IE10 or less to test :)
@iamw00t if you have access to an older browser, you can visit this URL: https://cdn.statically.io/gh/squirrellyjs/squirrelly/a9667606/demo.html and see if the editor is functional
Ben Gubler
@nebrelbug
By modern browsers I mean it should work on at least IE8+
iamw00t
@iamw00t
Thanks Ben, I was mostly wondering about IE 11
Scott Kipfer
@scottkipfer_twitter
Hi, I was wondering if it would be beneficial to read all my templates in at run time and compile them or just use renderFile.
Ben Gubler
@nebrelbug
@scottkipfer_twitter I would probably just use renderFile. If you're looking for the best performance, it would probably be ideal to use a custom precompile/cache solution
Scott Kipfer
@scottkipfer_twitter
@nebrelbug thanks for the response, I started making a squirrelly plugin for fastify (https://github.com/scottkipfer/fastify-squirrelly). It's not quite production ready. I would love any feedback or suggestions.
Ben Gubler
@nebrelbug
@scottkipfer_twitter this looks great! I'll give it a try and get back to you if I have any suggestions :)
Ben Gubler
@nebrelbug
@iamw00t I just tested, and it looks like Squirrelly actually does not work with IE8. It should work with later versions, though
saeedcs
@saeedcs
I would like to know how to call a 2nd template file in first
saeedcs
@saeedcs
I figured out how to do this. basically in our code do renderFile
Is there a better way to do this please
Ben Gubler
@nebrelbug
Hi @saeedcs! For now, the best way would probably be to define a custom helper.
Ben Gubler
@nebrelbug
@saeedcs try something like this (taken in part from @scottkipfer_twitter's fastify plugin):
const Sqrl = require("squirrelly");
const path = require("path");
const klaw = require("klaw-sync");
const fs = require("fs");

const partialsDir = path.join(cwd, "/partials");

const paths = klaw(partialsDir, { nodir: true })

// Loop through each path
paths.forEach(({ path }) => {
  // get template content
  const file = fs.readFileSync(path);
  // convert file name to a template name
  const importName = path
    .split(dir)
    .join("")
    .replace(/\.[^/.]+$/, "")
    .replace(/^\//g, "");
  Sqrl.definePartial(importName, file);
});

Sqrl.defineHelper("include", function(args, content, blocks) {
  //Do whatever you want here with the arguments, blocks, and content, then return a string
  return Sqrl.P[args[0]](args[1]);
});
saeedcs
@saeedcs
HI Ben, Thanks for your reply, I will try it out and let you know how it goes
Ben Gubler
@nebrelbug
@/all I've decided to release one more version between the current version and the version with a custom parser. See details at #132
Please respond w/ any feedback!
rmvedas
@rmvedas
fantastic work @nebrelbug !
If you are around would love to have a quick chat. cheers
dtrikannad
@dtrikannad
@nebrelbug That sample code is awesome! Thank you for sharing it!
Ben Gubler
@nebrelbug
@dtrikannad I'm glad it was helpful!
@rmvedas thanks! I'd love to chat -- DMing me on Gitter is probably easiest
msaus
@msaus
Hello. Is this faster than this template engine? https://github.com/aui/art-template
Ben Gubler
@nebrelbug
Hi @msaus! As of right now, Squirrelly comes in second behind Art-template when I add it to the Art-template benchmarks. However, Squirrelly supports many features Art-template does not, like filters
msaus
@msaus
HI @nebrelbug ! Thanks for your information. Do you think you can increase performance?
Ben Gubler
@nebrelbug
@msaus that's the goal! Actually, I'm working on the next version right now which should have significantly increased performance :)
msaus
@msaus
@nebrelbug Great! I may wait for it:) Possibly, it would be released next year?
Ben Gubler
@nebrelbug
@msaus Actually, it will hopefully be released by around Jan 20
msaus
@msaus
@nebrelbug Oh! Thats quick. I may start using it from next week.
Clément Lakhal
@clemlak
Hello :)
Quick question guys, is there a way to get syntax highlighting somehow?
I'm working on a relatively big template and it's getting confusing sometimes
Ben Gubler
@nebrelbug

Hi @clemlak! As of right now I haven't built any syntax highlighting plugins. I plan on building some with the next release of Squirrelly sometime next year.

However, if you wanted to build one, it shouldn't take much work at all! See

Clément Lakhal
@clemlak
Thanks for your reply :)
I might give it a shot actually, I’m using Squirrelly for a project and I might need to create several templates in the future
I’ll let you know :)
Ben Gubler
@nebrelbug
:thumbsup: you should do it!
Clément Lakhal
@clemlak
Capture d’écran 2019-11-27 à 09.18.31.png
Still needs some work but we’re getting there :)
Ben Gubler
@nebrelbug
@clemlak looks great!
Clément Lakhal
@clemlak
Thanks!
Ben Gubler
@nebrelbug

@msaus another thing that I just realized is that art-templateis about 100KB minzipped, compared to Squirrelly, which is about 2KB minzipped.

Squirrelly is 45 times smaller! Art-template is a really cool program and can match lots of scenarios quickly, but if you don't want to significantly increase bundle size, Squirrelly is your best bet :)

Brian Dijkstra
@briandijkstra_twitter
Hello, is got a question can i use nl2br or raw in the template engine.. like {{@this.description|nl2br}} or {{@this.description|raw}}