jade

Install / Use Pug (Jade) Angular 2 + (for cli version, no custom Webpack)

匿名 (未验证) 提交于 2019-12-03 02:41:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to install correctly PUG / JADE to Angular 2 or above So that while working and AOT and JiT Worked Unit and Integration Tests and do not suffer much when creating each new component 回答1: I saw many solutions, some of them: in each component was added something like "reqiure!pug-loader()some.component.pug" Get away from using angular-cli and create magic around webpack Use other servers (who know how to work with the Pug / Jade) Before running the build, convert all the pug files to html I think that they will refuse the server justified

Angular and Express routing

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been through many Angular-express seeds and kind of worked out how they work. The problem I am having is: 1). I would like to use ejs-locals for templating. 2). How to configure correctly the routing of the server-side and client-side. And also, when entering a URL such as /about , not to generate the error: cannot /get angular app.js contains: // angular stuff $routeprovider.when('/', { templateUrl: 'index', controller: IndexCtrl }); $routeprovider.when('/about', { templateUrl: 'partials/about', controller: IndexCtrl }); express app,js

Jade - convert new lines to <br/> and keep the content encoded

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am still not that familiar with the Jade template engine. Is there a way to convert the new lines such as \n to br tags and at the same time keep the other content encoded? For example .replace(/\n/g,'') applied over the encoded value should do the work. However I am not sure how to encode the value and get the result. Is there any helper for this? 回答1: You can use jades escape method and replace the linebreaks in the return value of that like so: p !{escape(foo).replace(/\n/g, ' ')} I am not aware of any built-in functionality for your

nodejs学习日志1--开发环境安装配置

橙三吉。 提交于 2019-12-03 01:08:12
nodejs作为新技术已经越来越成熟,1.0稳定版本也快发布了,机缘巧合,自己在公司也尝试了一把nodejs的web网站开发,本来我就是开发PHP的,看到介绍理论上node是比PHP要快,姑且不去理这些理论数据。 首先安装node,我是在windows环境直接官网下载安装。安装成功 命令行输入显示当前版本: node -v v0.10.5 通过这种方式安装的 Node.js 还自动附带了 npm(Nodejs的包管理器,从 Node.js 0.6 开始,npm 已包含在发行包中了)。由于我是开发web,所以需要安装node的web框架express(http://expressjs.jser.us/) npm install -g express 安装supervisor. 使用 supervisor 实现监视代码修改和自动重启 npm install -g supervisor 接下来创建项目,express -e projectname ,-h查看帮助,-e的话是使用ejs模板,默认是jade。 express3.0较之2.x改变了些许内容,详细见https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x。 supervisor app.js 启动,当代码被改动时,运行的脚本会被终止,然后重新启动。

Jade - calling page specific css pages

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have page specific css files I would like to call automatically. Does anyone have a nice way of doing this elegantly? 回答1: This should do it link(rel="stylesheet", href="#{req.path + '.css'}", type="text/css") Where you pass either req (the request object) as a local variable when rendering the jade template (or even just pass in req.path as path ). This could just be handled in your layout.jade and it will work for each of your route paths. If you want to get fancy, you could establish a consistent pattern where a page's route maps 1 to 1

Jade(Pug) 模板引擎使用文档

匿名 (未验证) 提交于 2019-12-03 00:32:02
在 Express 中调用 jade 模板引擎 jade 变量调用 if 判断 循环 Case 选择 在模板中调用其他语言 可重用的 jade 块 (Mixins) 模板包含 (Includes) 模板引用 (Extends) var express = require(‘express‘); var http = require(‘http‘); var app = express(); app.set(‘view engine‘, ‘jade‘); // 设置模板引擎 app.set(‘views‘, __dirname); // 设置模板相对路径(相对当前目录) app.get(‘/‘, function(req, res) { res.render(‘test‘); // 调用当前路径下的 test.jade 模板 }) var server = http.createServer(app); server.listen(3002); console.log(‘server started on http://127.0.0.1:3002/‘); test.jade p hello jade //<p>hello jade</p> 如果文本比较长可以使用 p | foo bar baz | rawr rawr //或 p. foo bar baz rawr rawr /

Jade插入emoji字符总结

坚强是说给别人听的谎言 提交于 2019-12-02 03:16:59
不修改Mysql 服务器字符集(character_set_server=utf8mb4)的前提下,使用Jade插入Emoji字符. Mysql服务器字符集设置: mysql> show variables like 'character%'; +--------------------------+---------------------------------------+ | Variable_name | Value | +--------------------------+---------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /opt/mysql/server-5.6/share/charsets/ | +--------

前端技术之:常见的前端页面模板库

倾然丶 夕夏残阳落幕 提交于 2019-11-30 17:59:48
VueJs https://cn.vuejs.org/ https://github.com/vuejs/vue React https://reactjs.org/ Handlebars http://handlebarsjs.com/ https://github.com/wycats/handlebars.js Mustache https://mustache.github.io/ Ejs https://github.com/tj/ejs ArtTemplate http://aui.github.io/art-template/zh-cn/ https://github.com/aui/art-template Jade/Pug http://jade-lang.com/ https://pugjs.org NunJucsks https://mozilla.github.io/nunjucks/ Template7 Template7 is a mobile-first JavaScript template engine with Handlebars-like syntax. https://framework7.io/docs/template7.html UnderscoreJs Template https://underscorejs.org/

模版引擎总结之综合分析模版引擎

折月煮酒 提交于 2019-11-29 22:11:05
Velocity 渲染方式:一种渲染方式,java服务端渲染 java服务端渲染 语法:一种语法 -》 #:关键字使用#开头 $:变量使用$开头 artTemplate 渲染方式:node服务端渲染、浏览器渲染 语法:两种语法 -》 标准语法【{{ }}】和原始语法【<%=、-、#、%、_ -、_%>】,其中原始语法兼容EJS(和EJS语法相同) doT 渲染方式:两种渲染方式,node服务端渲染、浏览器渲染 node服务端渲染 浏览器渲染   引入: <script type="text/javascript" src="doT.js"></script>   方式一:var template = doT.template(str,options,data)       template(data) 语法:一种语法 -》【 {{=、~、?、!、#、 ## }}】 Jade 渲染方式:一种渲染方式,node服务端渲染 node服务端渲染   方式一:var str = jade.render(str,options)   方式二:var str = jade.rednderFile(fileName,options)   方式三:var template = jade.compile(str,options)      template(data) -》返回字符串   方式四

Spring/Spring-Boot 学习 paoding-rose-jade 连接MySQL数据库

你说的曾经没有我的故事 提交于 2019-11-27 12:53:29
项目依赖 新建一个 spring-boot 工程, maven 的 pom 文件中添加如下依赖: <!--spring-boot起步依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <!--lombok依赖,可简化代码--> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <!--paoding-rose-jade基础依赖, 注意去除paoding-rose-jade中的spring相关依赖,否则会与项目本身的spring-boot冲突引发无法实例化bean的错误--> <dependency> <groupId>com.54chen</groupId> <artifactId>paoding-rose-jade</artifactId> <version>1.1</version> <!--排除paoding-rose-jade中的Spring相关依赖--> <exclusions>