• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

tambourinecoder/gulp-jst-concat: Compile underscore / lodash view templates to a ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

tambourinecoder/gulp-jst-concat

开源软件地址(OpenSource Url):

https://github.com/tambourinecoder/gulp-jst-concat

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-jst-concat Build Status

A gulp plugin to compile underscore / lodash views to a single JST file.

Install

Install using npm.

$ npm install gulp-jst-concat

Usage

var jade = require('gulp-jade')
  , jstConcat = require('gulp-jst-concat')

gulp.task('JST', function () {
  gulp.src('client/app/views/**/*jade')
    .pipe(jade())
    .pipe(jstConcat('jst.js', {
      renameKeys: ['^.*views/(.*).html$', '$1']
    }))
    .pipe(gulp.dest('public/assets'))
})

This compiles all of your client-side views into a single file jst.js, defining this.JST = { /* template fns */ }.

Let's say we have views located at

  • client/app/views/foo.jade and
  • client/app/views/bar/baz.jade.

Given the example's option renameKeys: ['^.*views/(.*).html$', '$1'] those views will now be accessible as compiled lodash template functions via

  • JST['foo'] and
  • JST['bar/baz'].

(Please note that gulp-jst-concat doesn't have to be used in conjunction with gulp-jade. Any input-stream emitting html-ish file contents will do.)

Options

renameKeys

Type [String, String]

Control your JST keys by RegExp-replacing the input file's path property.

This will default to ['.*', '$&'] (i.e. a template's key will just be it's input file's path).

License

MIT




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap