-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Nunjucks for js files #13
Comments
I'm not sure to understand your case. Can I see an example? |
these are front-end js files in script tags. So, within one of these I fetch, for example, some api keys from my site data:
If I have that inline in Is that clear? |
Understood. lume ignores all files with extensions not recognized by any template engine. So, for example In theory, if you save the file as Other option is include a frontmatter with the permalink value, so you can decide the exact output name of this file. Create a
Or even shorted
|
ok, thanks - I'll try this out this afternoon. (Thanks for reminding me of To give you some context, I used to use PHP servers, and used this sort of templating a lot. However, for sites where the data doesn't change very often, static site generators will do just as well. I started off using Github Pages, which was limited to Jekyll, but I switched to GitLab a few years ago, where I can run anything. Deno/Lume is way faster than Jekyll: the site I'm working on took several minutes with Jekyll, but <1 minute with Lume, and most of that is loading the Docker image. |
Oh, interesting! Thanks for let me know :) I did some performance tests some time ago (using this repo: https://github.com/seancdavis/ssg-build-performance-tests) but I think there's plenty room for improvements yet. FYI, Yesterday I've released a new version that allows to have support for |
this doesn't seem to work. I renamed the file to |
oh, and another problem is that it wraps it in the default layout file. I could get around this by creating an empty layout. Jekyll has the option |
I'll take a look. |
I just tested your use case and it works fine to me. In this directory: https://github.com/lumeland/test/tree/master/pages There's a So I suspect something is wrong in your side. |
yes, sorry, my bad. I had the js in a new dir, and forgot to copy |
Wow, impresive! Thanks |
In #11, I mentioned being able to use templates with js files, so I can for example populate an array from shared data. You can do this In Jekyll (and can define
layout: null
for non-html files). I hoped that if I specified a_data.json
withtemplateEngine: njk
it would work, but it ignores the directory. If I rename the js file to*.njk
, then it creates an output html, but doesn't parse the templates.In the particular case I'm working on, I can get around this by including the js in the html file, but that's not very efficient if I have several html pages that use the same js.
The text was updated successfully, but these errors were encountered: