Permalink
Browse files

Merge pull request #2 from geometria-lab/feature/abortCssPlugin

abort css requests plugin
  • Loading branch information...
2 parents 99d5d74 + 7f82951 commit fcb01200934350f8249badf8c869898b9e6861df @shumkov shumkov committed Jul 9, 2014
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/plugins/abortCssRequests.js
@@ -0,0 +1,14 @@
+module.exports = {
+ beforeEngineInit: function (renderer, engine, next) {
+ if (engine.phantom !== undefined) {
+ engine.phantom.page.onResourceRequested(function (requestData, networkRequest) {
+ var regex = /.+\.css$/i;
+ if (regex.test(requestData.url)) {
+ networkRequest.abort();
+ }
+ });
+ }
+
+ next();
+ }
+};

0 comments on commit fcb0120

Please sign in to comment.