0.1.7 • Published 9 years ago
gulp-cedr v0.1.7
gulp-cedr  
 
gulp-cedr - Gulp plugin for a cedr.
Installation
$ npm install --save gulp-cedrUsage
More about cedr.
More about cedr-library.
More about cedr-deps.
'use strict'
const cedrlibrary	= require('cedr-library');
const cedrDeps		= require('cedr-deps');
const cedr			= require('gulp-cedr');
const gulp 			= require('gulp');
let library = {},
	scripts = {},
	styles = {};
gulp.task('library', (callback) => {
	cedrlibrary(['libraries/antitim-lib/'], function(mergedLibrary) {
		library = mergedLibrary;
		let deps = cedrDeps(true, mergedLibrary);
		styles 	= deps.style;
		scripts = deps.script;
		callback(null);
	});
});
gulp.task('pages', ['library'], function() {
	return gulp.src('pages/*.js')
		.pipe(сedr({
			library: library
		}))
		.pipe(gulp.dest('./result/'));
});
gulp.task('css', ['library'], function() {
	return gulp.src(styles)
		.pipe(gulp.dest('./result/css/'))
});
gulp.task('js', ['library'], function() {
	return gulp.src(scripts)
		.pipe(gulp.dest('./result/js/'))
});
gulp.task('default', ['css', 'js', 'pages'], function() {
	console.log('Complete')
});include and extend
JS files containing pages run in one context while forming the html. On this basis, to use include or extend, you can use the following construction:
_helpers.js
function layout(content_1) {
	return {
		block: 'page',
		content: [
			{ block: 'header' },
			content_1,
			{ block: 'footer' }
		]
	}
}
function menu() {
	return {
		block: 'menu',
		content: [
			{ 
				block: 'menu',
				element: 'item'
			}
		]
	}
}page.js
layout([
	{
		block: 'breadcrumbs'
	},
	menu()
	...
])Options
library
Type: Object
The object of library.
License
MIT © antitim