diff --git a/index.js b/index.js
index <HASH>..<HASH> 100755
--- a/index.js
+++ b/index.js
@@ -15,6 +15,11 @@ module.exports = function (options) {
             return cb(null, file);
         }
 
+        var data = options.data || {};
+        if (file.data) {
+          data = file.data;
+        }
+
         if (file.isStream()) {
             return cb(new gutil.PluginError(PLUGIN_NAME, "Streaming not supported!"));
         }
@@ -40,16 +45,10 @@ module.exports = function (options) {
             Twig.cache(false);
         }
 
-        if (options.functions) {
-            options.functions.forEach(function (func) {
-                Twig.extendFunction(func.name, func.func);
-            });
-        }
-
         template = twig(twigOpts);
 
         try {
-            file.contents = new Buffer(template.render(options.data));
+            file.contents = new Buffer(template.render(data));
         }catch(e){
             if (options.errorLogToConsole) {
                 gutil.log(PLUGIN_NAME + ' ' + e);
Add compatibility with gulp-data

Allow gulp-data to pass in data attribute via file.data