使用翡翠作为纯文本的模板语言
我正在使用玉来制作html电子邮件。 你知道,个性化的“到”领域,这样的事情。 我想提供纯文本版本。 有没有办法将玉石编译成纯文本?
如果玉 – > HTML – >纯是一个可以接受的解决scheme,你可以这样做: http : //requirebin.com/?gist=cbc4d126c842754fd545eff554a7767d
var htmlToText = require('html-to-text'); var jade = require('jade'); const jadeTemplate = `doctype html html(lang="en") head title= pageTitle script(type='text/javascript'). if (foo) { bar(1 + 5) } body h1 Jade - node template engine #container.col if youAreUsingJade p You are amazing else p Get on it! p. Jade is a terse and simple templating language with a strong focus on performance and powerful features.`; var html = jade.compile(jadeTemplate, {})({}); var text = htmlToText.fromString(html, { wordwrap: 130 }); document.getElementById('text').value = text;
- Nodejs – 多个发布请求
- JavaScript:通过console.log输出意外('str'+ int + int)
- 直接在node.js中使用PhantomJS的问题
- 轮询RequireJS提供的资源
- 在React-Native中使用Node.js内置模块的polyfills
- 如何有效地search有关JavaScript(NodeJS)对象types的文档?
- nodejs redis Q promise,如何使它工作?
- 如何在async.each中包含async.waterfall的外部函数中调用async.each
- Sequelize JS / Bluebird:从asynchronous并行数据库调用开始