0.1.7 • Published 7 years ago

gulp-cedr v0.1.7

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

gulp-cedr NPM version Dependency Status

gulp-cedr - Gulp plugin for a cedr.

Installation

$ npm install --save gulp-cedr

Usage

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

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago