forked from CREEATION/laravel-elixir-jade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
71 lines (61 loc) · 2.11 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var elixir = require('laravel-elixir');
var gulp = require('gulp');
var jade = require('gulp-jade');
var rename = require('gulp-rename');
var plumber = require('gulp-plumber');
var notify = require('gulp-notify');
var changed = require('gulp-changed');
var jadeInheritance = require('gulp-jade-inheritance');
var _ = require('underscore');
var Task = elixir.Task;
/*
|----------------------------------------------------------------
| Gulp Jade Wrapper
|----------------------------------------------------------------
|
| This task will compile your Jade files into your views folder.
| You can make use of Blade variables in your jade files as well.
| Examples see README.md
|
*/
elixir.extend('jade', function (options) {
options = _.extend({
baseDir: './resources',
blade: true,
dest: '/views/',
pretty: true,
search: '**/*.jade',
src: '/jade/'
}, options);
var gulp_src = options.baseDir + options.src + options.search;
var jade_options = _.pick(
options,
'filename',
'doctype',
'pretty',
'self',
'debug',
'compileDebug',
'compiler'
);
jade_options.basedir = options.baseDir + options.src;
var gulp_dest = options.baseDir + options.dest;
var extension = (options.blade === true ? '.blade.php' : '.php');
new Task('jade', function() {
return gulp.src(gulp_src)
.pipe(plumber())
.pipe(changed(gulp_dest, { extension: extension }))
.pipe(jadeInheritance({basedir: options.baseDir + options.src }))
.pipe(jade(jade_options))
.pipe(rename(function (path) {
path.extname = extension
}))
.pipe(gulp.dest(gulp_dest))
.pipe(notify({
title: 'Jade completed',
message: '<%= file.relative %> Compiled.',
icon: __dirname + '/../laravel-elixir/icons/pass.png'
}));
})
.watch([ options.baseDir + options.src + options.search ]);
});