GithubHelp home page GithubHelp logo

Comments (7)

davestewart avatar davestewart commented on June 20, 2024 5

@olsonpm - well you may have a point, but I have a bunch of OS repositories which I'm quite happy taking usage questions on.

The way I see it, if I answer a question once, it's easy to search and refer people to again.

If it's a really good question, I can use it in the documention.

from nunjucks-loader.

olsonpm avatar olsonpm commented on June 20, 2024

I know everyone treats repos differently, but generally those questions are better fit for stack overflow after you've figured out a specific problem you're having.

from nunjucks-loader.

likemusic avatar likemusic commented on June 20, 2024

@davestewart Do you have a success in using Nunjucks with Vue?

from nunjucks-loader.

likemusic avatar likemusic commented on June 20, 2024

Currently I have trying to use it.
For temaplte like this:

<template lang="njk">
    <div>Nunjucks!</div>
</template>

Vue template loader got string like this, instead of compiled template:

var nunjucks = require("nunjucks/browser/nunjucks-slim");
var env;
if (!nunjucks.currentEnv){
	env = nunjucks.currentEnv = new nunjucks.Environment([], {"dev":false,"autoescape":true,"throwOnUndefined":false,"trimBlocks":false,"lstripBlocks":false});
} else {
	env = nunjucks.currentEnv;
}
var dependencies = nunjucks.webpackDependencies || (nunjucks.webpackDependencies = {});




var shim = require("/var/www/node_modules/nunjucks-loader/runtime-shim");


(function() {(nunjucks.nunjucksPrecompiled = nunjucks.nunjucksPrecompiled || {})["resources/js/Domain/Invoices/Outgoing/Waybill/TestNunjucks.vue"] = (function() {
function root(env, context, frame, runtime, cb) {
var lineno = 0;
var colno = 0;
var output = "";
try {
var parentTemplate = null;
output += "\n<div>Nunjucks!</div>\n";
if(parentTemplate) {
parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);
} else {
cb(null, output);
}
;
} catch (e) {
  cb(runtime.handleError(e, lineno, colno));
}
}
return {
root: root
};

})();
})();



module.exports = shim(nunjucks, env, nunjucks.nunjucksPrecompiled["resources/js/Domain/Invoices/Outgoing/Waybill/TestNunjucks.vue"] , dependencies)"

from nunjucks-loader.

likemusic avatar likemusic commented on June 20, 2024

From #24 I found nunjucks-html-loader. Seems it works well with vue-loader.

from nunjucks-loader.

davestewart avatar davestewart commented on June 20, 2024

Hey @likemusic - I haven't needed to since, so ended up ceasing investigations.

Good news about the loader though.

Is that related to your other project?

from nunjucks-loader.

likemusic avatar likemusic commented on June 20, 2024

@davestewart If you means vue-template-extends, then it not uses nunjucks-html-loader at all (just vue for parsing components and compile templates and jsdom to manipulate with templates html-code).

And I ended up ceasing investigations with nunjucks-html-loader too, after get success with compile simple template from my 3rd comment, because I had an Epiphany with my loader. So because I trying to use nunjucks just for extend templates, I currently use my loader, because its more lightweight and clear solution, then using 3-rd party template processor.

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.