GithubHelp home page GithubHelp logo

Create 4x branch about nunjucks-loader HOT 8 OPEN

at0g avatar at0g commented on June 20, 2024 1
Create 4x branch

from nunjucks-loader.

Comments (8)

chrisfarms avatar chrisfarms commented on June 20, 2024 9

Thanks at0g ... I'd def be interested in taking over maintaining the module if you're not very active in the nunjucks space these days.... however what would be even better for the community is if I can get my workplace to adopt the project ... they are using nunjucks in a few projects so I'll see if I can drum up some support

from nunjucks-loader.

chrisfarms avatar chrisfarms commented on June 20, 2024 2

I was just trying to solve this problem (making a loader for node-side that plays nicely with html-loader). It looks like I'll be using nunjucks for some time at work so I might be interested in helping out on this project.

I took a slightly different approach by parsing the templates during the "pitch" phase so that we can collect all the required templates sources and use a custom Loader to pull them out of the require system.... it wasn't pretty... but it works.

It's a shame there's no way to fully precompile the templates AND support other loaders since I'm sure there's some tree shaking that we will miss out on.

Anyway... I just pushed a PoC here: https://github.com/chrisfarms/njk-loader

Since I don't need browser compilation I didn't even attempt to solve that, but the same technic should work.

Let me know if you think this might be a good direction for nunjucks-loader and I'll have a go polishing it up into a PR with tests/browser support.

from nunjucks-loader.

at0g avatar at0g commented on June 20, 2024 1

@chrisfarms - sorry about the delay... there is a lot going on with life at the moment. I'll try for tests this week. Failing that, I agree with not creating another loader, so will gladly hand over the module name if you want to maintain it.

from nunjucks-loader.

at0g avatar at0g commented on June 20, 2024

@chrisfarms Thanks for your input.
A custom Loader that leverages require sounds like a better approach than rewriting the runtime... so yes, I think this could be a good direction :)

Give me a week (to find some time) and I will update the sibling packages in the 3.x branch with test suites for specific scenarios (node, browser, umd, template inheritance, filters, macros etc).

from nunjucks-loader.

bonesoul avatar bonesoul commented on June 20, 2024

how about webpack 4.x support?

from nunjucks-loader.

chrisfarms avatar chrisfarms commented on June 20, 2024

I continued to mature the version I was working on at chrisfarms/njk-loader#2 ... it should now work for browsers and webpack 4 ... hopefully I'll find some time this weekend to finish up adding tests ... but if @at0g can get some test in here I'd be happy to port it over to here rather than creating yet another loader.

from nunjucks-loader.

danielpza avatar danielpza commented on June 20, 2024

@chrisfarms any updates ?

from nunjucks-loader.

mdmoreau avatar mdmoreau commented on June 20, 2024

@at0g @chrisfarms Are there any updates on this? Trying to decide on a template engine and loader, so figured I'd drop a quick message here.

from nunjucks-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.