Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make an example project, using Squirrelly, for beginners #65

Closed
nebrelbug opened this issue Oct 4, 2018 · 22 comments
Closed

Make an example project, using Squirrelly, for beginners #65

nebrelbug opened this issue Oct 4, 2018 · 22 comments

Comments

@nebrelbug
Copy link
Collaborator

A good project would be fairly simple, and well commented.
Steps:

  1. Create new project using Squirrelly
    • It could use Express, or run as a web page, or something else
  2. Upload project to Github
  3. Comment here with the link--we'll probably put it in cheatsheet.md or the online docs or wiki
@Jayadev6191
Copy link

@nebrelbug Can I take this ?

@nebrelbug
Copy link
Collaborator Author

@Jayadev6191 that would be great!

@nebrelbug
Copy link
Collaborator Author

@Jayadev6191 do you have any questions?

@Jayadev6191
Copy link

Jayadev6191 commented Oct 8, 2018

@nebrelbug I have started working on this with an express app. I will am planning to build a simple page application which incorporates all the functionalities of the library. Once I figure out how to use all the features (e.g building my own squirrelly custom helpers) I will add meaningful content to the project.

example-project
Please let me know if I'm on the right path or something needs to be changed in the way that I'm building the example project.

@nebrelbug
Copy link
Collaborator Author

@Jayadev6191 I actually just found a bug with Squirrelly and Express ☹️. Hopefully I'll have it fixed by tomorrow, but pause on your repo until then. Thanks!

@Jayadev6191
Copy link

No worries. Thanks for letting me know!

@nebrelbug
Copy link
Collaborator Author

Hi @Jayadev6191! I just pushed changes that should fix the problem (along with adding caching, which should make everything a lot faster) to the fsprob branch.

After a little more testing, I'll merge the changes to master and publish a new version on NPM, hopefully by the end of tomorrow. At that point, you'll be able to work on it :)

@Jayadev6191
Copy link

Hi @nebrelbug great! Please let me know once you publish it :)
Also, can you explain how that bug that you are trying to fix is blocking me from making additional changes ?

@nebrelbug
Copy link
Collaborator Author

@Jayadev6191 Squirrelly exports Sqrl.__express, which makes it so that you could follow a tutorial like this: https://expressjs.com/en/guide/using-template-engines.html, just installing Squirrelly instead of Pug, and making an index.squirrelly. It handles caching and rendering for you, so you don't have to do it all by hand.

@nebrelbug
Copy link
Collaborator Author

@Jayadev6191 I just published 6.0.0-beta. You can install that by npm install squirrelly@beta, and then you should just be able to follow a tutorial like the one above and create a repo without much trouble. I'm going to work a couple of days on testing and minification before I publish without beta, but you can get started as soon as you want. Thanks!

@Jayadev6191
Copy link

Hi @nebrelbug sounds great! I will continue working on the example project without the beta. Thanks! :)

@nebrelbug
Copy link
Collaborator Author

@Jayadev6191 I just published version 6.0.1. Working with Squirrelly and Express should be lots easier now--just follow the instructions here: https://expressjs.com/en/guide/using-template-engines.html but with Squirrelly. Thanks!

@Jayadev6191
Copy link

Thank you sir! Will work on this today and tomorrow.

@Jayadev6191
Copy link

Jayadev6191 commented Oct 22, 2018

@nebrelbug The changes you made for the package(to make it work on express) expects the template files to have any specific extension (for e.g <temaplate_name.sqrl>) ? Please confirm. I made changes to my main file to have a view engine and passed Sqrl object to it.

let express = require('express');
let path = require('path');
let Sqrl = require("squirrelly");
let app = express();

app.set('view engine', Sqrl)
app.set('views', path.join(__dirname, 'views'))

Please let me know if this is the right way to set the template engine for squirrelly.

@nebrelbug
Copy link
Collaborator Author

That looks good! It expects files to have the extension .squirrelly, so for example index.squirrelly. I know you can just do app.set('view engine', 'squirrelly'), but your way might work too. You should also just be able to app.set('views', './views'). Thanks!

@nebrelbug
Copy link
Collaborator Author

@jeanha124 do you need any help? Here's a link that might be useful: https://squirrelly.js.org/recipes/squirrelly-with-expressjs. Thank you!

@Jayadev6191
Copy link

@nebrelbug Was that meant for me ? If yes, You've tagged a different person! 😀
I made some progress on the https://github.com/Jayadev6191/squirrelly-example-project

I looked at your codepen example to see how you have used custom Helpers which was not very clear. I might spend sometime on that and get back to you over the weekend.

Thanks,
Jay

@nebrelbug
Copy link
Collaborator Author

Sorry @Jayadev6191!

@saeedcs
Copy link

saeedcs commented Nov 13, 2019

@Jayadev6191 How do we include one template file into another, any assistance in this matter will be appreciated

@hrsetyono
Copy link

Hi just want to contribute an example as a non-Node developer:

https://codepen.io/hrsetyono/pen/gOOZWgW

This basic usage in HTML is missing in the Learn section. We might think it's obvious how to do it, but lots of beginners will find this easier to grasp.

@nebrelbug
Copy link
Collaborator Author

@hrsetyono this is great! Would you like to put together a pull request to add this to the docs?

If not I'll add it, probably under Resources / Examples 😃

@hrsetyono
Copy link

hrsetyono commented Nov 20, 2019

@nebrelbug Glad you like it. Feel free to add it to the Resources / Examples.

Maybe it's better to expand it a little to include For loop and IF conditional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants