Giter Site home page Giter Site logo

gulp-dot-preparse's Introduction

gulp-dot-preparse

Compile dot template to UMD .js file

Install

$ npm install gulp-dot-preparse --save-dev

Usage

var dotPreparse = require('gulp-dot-preparse');

gulp.task('default', function(){
	return gulp.src('template/**/*.jst')
		.pipe(dotPreparse({
			root: './template'
		}))
		.pipe(gulp.dest('./dist'));
});

Options

root

Type: String

Default: process.cwd()

Root of .def file.

global

Type: String

Default: window.dotTemplateRender

When use template with script tag,template function will inject to window.dotTemplateRender.

templateSettings

Type: Object

Default:

templateSettings: {
	evaluate:    /\{\{([\s\S]+?(\}?)+)\}\}/g,
	interpolate: /\{\{=([\s\S]+?)\}\}/g,
	encode:      /\{\{!([\s\S]+?)\}\}/g,
	use:         /\{\{#([\s\S]+?)\}\}/g,
	useParams:   /(^|[^\w$])def(?:\.|\[[\'\"])([\w$\.]+)(?:[\'\"]\])?\s*\:\s*([\w$\.]+|\"[^\"]+\"|\'[^\']+\'|\{[^\}]+\})/g,
	define:      /\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,
	defineParams:/^\s*([\w$]+):([\s\S]+)/,
	conditional: /\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,
	iterate:     /\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,
	varname:	"it",
	strip:		true,
	append:		true,
	selfcontained: false,
	doNotSkipEncoded: false
}

gulp-dot-preparse's People

Contributors

kuangyeheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar 江小鱼 avatar lms-sam avatar  avatar 小撸 avatar Xin Ouyang avatar ☜Samlv9☞ avatar

Watchers

James Cloos avatar

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.