Created
September 16, 2016 02:24
-
-
Save zrobit/d177a7925007b213b8dc30eb862d4d32 to your computer and use it in GitHub Desktop.
gulp jade pare task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'), | |
| jade = require('jade'), | |
| through = require('through2'); | |
| function jade_raw () { | |
| function stream () { | |
| function compile (file, enc, cb) { | |
| var compiled; | |
| var options = { | |
| // Jade options goes here :) | |
| pretty: true, | |
| filename: file.path | |
| }; | |
| compiled = jade2.compile(String(file.contents), options)(handler); | |
| file.path = file.path.substr(0, file.path.lastIndexOf(".")) + ".html"; | |
| file.contents = new Buffer(compiled); | |
| cb(null, file); | |
| } | |
| return through.obj(compile); | |
| } | |
| return gulp.src(['templates/**/*.jade']) | |
| .pipe(render()) | |
| .pipe(gulp.dest('build/templates')); | |
| } | |
| gulp.task('template:raw', jade_raw); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment